One of my application after clicking continue button refreshes and opens in a new tab and closes the old tab that had continue button.
Is there anyway that we can select the new tab as the current window and move forward?
I used the following code which didn't work.
selenium.select("");
selenium.select(null);
Any help would be appreciated.
There is an additional option for selenium server. You can add -singlewindow parameter when you are starting selenium server. This parameter will force selenium to open all pages in the same frame. Please look here for more details: http://seleniumhq.org/docs/05_selenium_rc.html#server-options
Best Regards
Pawel
Related
Is it anyhow possible in new relic scripted browser to interact with a popup?
Is the following possible and if yes, how can I achieve the following?
Open url "https://sample.com"
Click button with id login
A popup opens
In popup fill username and password and click submit
Popup closes
Continue within application.
Basically the popup is the piece I'm struggling with. I searched documentation but was not able to find anything on how to interact with the popup.
Thx I really appreciate your expertise
This depends on what popup is defined as - a new browser window or an element embedded in a div or iframe? Either way, here are some solutions to either one:
Switching to a new browser window: https://github.com/newrelic/quickstarts-synthetics-library/blob/main/library/TabOrWindowSwitching/script.js
New Relic forum post containing several solutions/examples: https://discuss.newrelic.com/t/how-to-handle-intermittent-pop-up/38200
I am facing below described issue while automating the application using selenium webdriver:
When I click on a link a new window should pen with the contents of that window, but when I click on the link new window is opening with login screen, what may be the issue, can anyone help me in this regard.
This issue is only with automation (manual click always works), but sometimes works.
Thanks in advance
Sounds like when a new window opens, all of the session cookies from the previous window are not being transferred. In this situation I would put a try catch block to login again if the login window appears.
I am using selenium webdriver + java + eclipse + testng for my automation scripts.
I am trying to get the URL of window which contains an alert box.
On clicking download button on a webpage, it opens an alert box in a new window. I want to fetch the URL of this window.
I tried getCurrentURL command for this but i am getting UnhandledAlertException : Modal dialog present. If i dismiss the alert box the window containing is immediately closed so it is not possible to get the URL.
It seems the alert box (modal dialog here) is blocking webdriver in reading the URL of the window.
Please suggest me a solution for this.
Thanks
I'm not sure I understand the question as an alert box does not have any URL !
Anyhow, you can access it this way : Alert alert = webDriver.switchTo().alert();
You can then retrive the text content or interact with it as described in here : http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/Alert.html
I think you need to get the set of windowHandles first for this driver.getWindowHandles();. Then get the required Handle of the newly opened window by iterating them. After that you can switch to the opened window using driver.switchTo().window("pass the handle here");
Now your control comes to new window. Then use like driver.getCurrentUrl();
Hope this could help you. Best Regards :)
I'm using the Selenium Client drivers to run tests built in C#. I'm having a problem where the test navigates to a page and clicks on a button in a form with its target set to _blank causing it to open a new window. However the new page being opened returns an XML document and not a typical webpage. Selenium seems to have trouble with this because it hangs when the button is click and the new window opens. No instructions after the click method are executed. The test eventually fails with the error Timed out running command.
Any help/guidance would be appreciated. I've scoured the net but haven't seen anyone running into this particular issue of the page being opened not being a typical webpage which I think is the core of the problem as Selenium can't really manipulate this new opened window. I would post code except that literally all I'm doing is calling the click method on a button which causes a new window to open. Thanks in advance.
To tackle the issue of opening in new window. I typically get url of the link which is to be opened and instead of using selenium.click(), I use:
selenium.open("http://yourwebsite/yourlink")
This helps me to be on the same window only(which avoids opening new window or tab) and when the testing is finished on this page and you want to switch back to original page you can again use:
selenium.open("http://whatever/")
I am having an issue with finding a popup window in some selenium test code. I am looking at the screen on the test runner and there are two IE windows, one of them is the popup and one of them the page which generated the popup. However selecting that window with
SelectWindow("name=SomeName")
fails. Putting a break point in there and running some diagnostics shows that
GetAllWindowNames()
returns only one window. Very odd. I have duplicated the problem in IE, chrome and firefox so I don't think it is browser specific. I am using C# to drive my tests. Any idea how I might solve this issue?
Edit:
I looked a bit more at how this page actually creates its popup by reloading itself with window.open added to its code. It is rather an odd way to open a popup but I don't see any reason why it isn't valid.
Is there title or some other attribute in popup window's source code? You can locate that using any info you find there. Try to record open popup window in Se IDE and click on something in that popup window. Usually this trick works.
IIRC, there are some situations where SElenium fails to register the window. In this case you can register the window anyway by using the openWindow(ยดยด, ). I think this is described in the explanation of openWindow in Selenijum IDE...