I am trying to load a page, and I am automating the process of checking for a POST request after a button is clicked.
In order to do this, I need to clear the Network tab of all previous entries before the button is clicked, otherwise it will not show up on the list for some reason.
Is there a way to do this via logging or some other means in Selenium Java?
As far as I know, there is no way to interact with Chrome's dev tools as you intent to. Alhough, if you are interested in obtaining/parse data from the Network tab in Chrome you can do that following their quick tutorial in their website here.
I don't know what is you idea but here I leave you 2 cents.
Perhaps you could access this data and work it elsewhere instead of constant refreshing.
Here is a similar question to yours.
Related
I want to be able to use Java to tell it to go to X url when X browser is open/running (my lingo is terrible). (Firefox/Chrome/IE is already up, and I want it to go from the default page to let's say Twitter.)
Most of the solutions are using java.awt.Desktop to launch native browser with a url in it, but that isn't useful if I want to change the url later on. (Already on Twitter-Home Page, but want to go to Twitter-Contact Us afterwards.)
The other solutions I've seen involve using Selenium WebDriver, but I also need to eventually learn how to basically force the Java to read a long list of URLs off an excel and simply verify that url isn't dead, and then do this on the Native Android browser, for example. So the Selenium might not be the right choice. Granted, you can also tell me this is an awesome choice for this too if it truly is. I haven't really been exploring Selenium.
Sorry for asking such a basic question. Company wants QA Automation without training/hiring an Automation QA. My end goal (aside not getting canned), is to see if I can get a bunch of urls to load on specific browsers. I can sort of (praying) be able to do stuff with it afterwards.
A simple trick would be to create an add-on( if you know javascript ) which will be quite similar in chrome and firefox (for IE I have no idea in my days it needed BHO) and send websocket commands from java to your addon. But this needs a java websocket server running where your addon will connect when the browser opens. Rest of communication can be carried upon the protocol lines of your requirements.
There are multiple parts to your question.
Read urls from excel.
Use Apache POI to do the same. Selenium code can use the same.
Check that the urls are not dead.
Use any java http client, (apache) to do that without even opening a browser. If the link is dead, it will be dead for all the browser.
Open the links in a multiple browsers.
Selenium is perfect for this. I am assuming that after the page is loaded you have way of validating that the page is correct. Selenium is very powerful here.
Target native android browser too.
I do not know of much difference between this and the previous question unless you are also testing site display based on browser size. The browser is more or less the same as chrome with webkit rendering engine.
I'm working on a some automation work, as per my requirement I need to click on Chrome Physical buttons like left nav, right nav, bookmarks, menu etc. I can do with shortcuts but my requirement is to click on browser buttons. Any ideas would be helpful. Thanks in advance.
As per your question you want to click on Chrome Physical buttons like left navigation, right navigation, bookmarks, menu etc.
But if you look into the documentation in Selenium Home Page it clearly mentions that :
The entire suite of tools provided by Selenium results in a rich set of testing functions specifically geared to the needs of testing of web applications. These operations allow many options for locating UI elements and comparing expected test results against actual application behavior.
So factually Selenium by design interacts with the HTML DOM and the WebElements located in the DOM Tree
Now the desired controls e.g. left navigation, right navigation, bookmarks, menu are out of the DOM. Hence you cannot mock the click on those controls.
However all the Selenium Language Binding Art provides a handfull of methods to achieve the same result. Here are a few from the Selenium Python Binding Art :
Maximize : To maximize the browser window.
driver.maximize_window()
Minimize : To minimize the browser window.
driver.minimize_window()
Close : To close the browser window.
driver.close()
Quit : To close the browser window gracefully.
driver.quit()
Refresh : To refresh the url.
driver.refresh()
Forward : To move forward.
driver.forward()
Back : To move backwards.
driver.back()
And of-coarse Get : To invoke an url.
driver.get('http://google.com/')
There are functions for this that is built-in:
driver.forward()
driver.back()
https://selenium-python.readthedocs.io/navigating.html#navigation-history-and-location
It doesn't appear that selenium can interact with the Bookmark, but let me check some more.
This can't be done with selenium webdriver and I think also not with the standalone selenium server. Selenium only allows to interact with the DOM.
The only way to achieve what you want to do is to use an automation tool that actually runs directly in the OS that you use. Java can be used to write such a program.
I would however recommend to not go this route. Instead try to convince whoever is responsible for your requirements to re-think and allow to use other means of achieving back and forward actions.
Im trying to accelerate the use of a web application using selenium Webdriver by creating hotkeys for it. I want certain webdriver click events to be associated with keyboard keys. For example, pressing "s" on the keyboard will click on the submit button.
I understand how to do the clicking and locating elements with webdriver but don't know how to go about listening to the keys from Java while Firefox is open (from a webdriver get call). My application has no GUI and since it's opening a firefox window it will lose focus so KeyListener is not an option.
I have come accross the JNI library that I'm looking into. Any other suggestions how I may do this?
In that case, it is almost always better idea to automate the whole process
Say, you need to daily update salary of the employees. It is better idea to invest your time to read XLS file (almost standard way how those data are delivered to the people destined to do the repetitive work) and read line by line and somehow enter it to the application.
I know I did not provide you the answer you were expecting, but try to think of automating the whole process. It might be little tricky, but doable - and at the end faster - than simple mapping of the keys
I've been pondering over this problem most the afternoon and haven't yet found the most ideal solution so thought I would see what others think..
There is a legacy Win16 application that has to be modified (with the least effort) in order to communicate with a web based application.
The idea is such that in the Win16 app, the user will want to look up a specific code, so they'll click a button which will then launch the browser and allow them to navigate a specific set of pages until they find the result they desire, then they have the option of either pressing Select or Cancel.
Pressing Select should pass back a small string back to the app (around 10 characters) and close the browser. Cancel will likewise send a Cancel message back to the app and again close the browser window.
I can't see many choices available in implementation as the Win16 app is not able to call webservices, so I'm looking at using the clipboard, however that is not without problems.
I hope there's some other alternative I haven't thought of,
As always - all advice appreciated.
Thanks,
i am developing mobile web app using spring(spring mvc). I need to devlope a form which enables the user to upload file(resume) and on submit it will be stored in database.
I am not getting the idea how to finish that!
In the form when i use input type as file, it's working in diffrent manner on diffrent browser. If any one have did it ,please tell me the steps or some working demo at any site.
yes i don't want to use some third party tool.
thanx.
Sorry dude, your kinda SOL on this one. The file input type is a different beast than most. Each browser implements it in their own way, so it will never look the same on multiple browsers. Also, for security reasons, you can't trigger the file inputs with JavaScript, so you can't make an invisible file input that you would interact with through other standard inputs. Many before you have tried, all have failed. I spent days researching possible alternatives when I had nothing better to do, and they all came up against the security issue. Jquery provides the closest thing but still required a browser switch for one of the major browsers (can't remember which one off the top of my head).
So now that the bad news is out of the way, here's what you can do. Put a button on the screen and style it how you like. Put a file input on the screen and using absolute positioning and a higher z-index put it right over the top of your button. Now make it transparent (not display none, but using opacity and filter:alpha styles), now the user thinks they are interacting with your standard button, but the invisible file input above it intercepts the click. Will be the closes you can get to a file input that behaves and looks the same in all browsers.