Robot Test not selecting new window - internet-explorer-11

the application under test is an internal site. i am not able to select the new window when i run the test in IE. this is the part of my test that is having the error
Run report
input text txtSearchKey TestProduct
click element searchButton
click element xpath=//*[#id='tblProductSelect']/tbody/tr[1]/td
wait until element is not visible loadingDiv
click button id=btnRunReport
wait until element is not visible loadingDiv
get window identifiers
get window names
select window Product Report
when btnRunReport is clicked, the application opens in a new tab and shows the report. this is whats happening when a user goes to the application and generates a report in chrome or in IE.
when i run this test, it works fine in Chrome. the report opens in a new tab and i can select that tab. in IE, it opens in new window, which is expected behavior (reference: https://github.com/SeleniumHQ/selenium/issues/5108).
i have no problem with it opening in new window but i am not able to select that new window. im getting this error - ValueError: Unable to locate window with handle or name or title or URL 'Product Report'
the "get window identifiers" and "get window names" only gets 1 browser. it doesnt seem to recognize the second one. also, on the Suite Teardown, the second window doesnt get closed.
thanks. i hope someone can help me.
Here are my system specs:
OS - Windows 7
Browser - IE11
Robot Framework Version - 3.0.2
IEDriverServer version - 3.4
Selenium2Library version - 1.8.0

Related

getWindowHandles not working properly with latest edge browser version

I am working on an application which supports only Edge Browser.
The login functionality works as follows -
On the login screen, when username and password values are provided and login button is clicked, a new browser window opens with an active alert pop-up saying Login Successful along with OK button similar to the image below -
Also, when this new window opens, the old browser window goes blank.
When user clicks on this OK button (or hits ENTER button on keyboard), user home page loads on this new browser window itself and the old window remains black throughout the session.
Automation -
To handle this flow in automation, I have used getWindowHandles() method where I get the handle of this newly opened window and accept the alert.
This used to work properly till edge browser version 105.
However, when the edge browser version was upgraded to 107, I started facing the issue where the getWindowHandles() method goes into infinite loop and eventually the test times out.
I also tried to simulate ENTER button hit by using Robot class but it made no difference.
I have tried using the edge-driver version matching with the current browser version 107 but the issue persists.
Can someone please let me know what can be done for this? Is these any known issue with newer edge browser version?
Thanks in advance..!!
This is the code written to handle multiple windows and the test times out at getWindowHandles() method itself.
for(String wh : driver.getWindowHandles()){
driver.switchTo().window(wh);
}
Adding a Wait may be the key to this problem:
WebDriverWait wait = new WebDriverWait(driver,20);
BTW, I've tested in Edge 108 (also with Edge Driver 108). There's no such error message and everything works great. You can upgrade to 108 and see whether this issue has been fixed.

Kantu testing automation Select button

I have an issue with Kantu Select button on both Firefox and Chrome on Mac When I press the Select button to get the object locator on the page I see the Kantu icon with "yellow S" that means that Kantu in Select mode. However, when I click on any object in the page; it doesn't select anything. I accedntially opened a new tab and found that the Select is working on the new opened tab, instead of the required first tab.
Any help please?
Thanks

driver.switchTo().Alerts() in selenium webdriver using java NOT working in IE11 when executed in perfecto

I will let you know the exact scenario of the issue that I am facing right now while working on IE 11 browser in Win 10 using Perfecto.
Scenario: A webpage has a frame and that frame inturn has a table consisting of lot of data. One such data happens to be a "Delete" link and upon clicking it, I get a pop up of "Are you sure?" with Yes or No buttons.
driver.switchTo().frame(frameID);
Challenge: driver.switchTo().Alert() is not working in Windows 10 - IE11 browser in Perfecto where as it works in CHrome browser of same OS combinations:
Solutions Tried:
1)
((JavaScriptExecutor)driver).executeScript("window.confirm=function(){return true;}");
and many such trail and error methods in javaScriptExecutor.
Error faced: Since "driver" instance is inside Frame, when we execute window.confirm or window.alert, I am facing NullPointerException.
2) Using Robot class for blind ENTER key.
Robot rb = new Robot();
rb.delay(2000);
rb.pressKey(KeyEvent.VK_ENTER);
rb.releaseKey(KeyEvent.VK_ENTER);
Error Faced: Doesn't work. Pop up stays right there.
3) driver.switchTo().defaultContent()
Error faced - closes the pop up and control goes to the webpage without deleting the record which is not the functionality.
4) driver.switchTo().ActiveElement()
Error faced: throws WebDriverException.
Please help in providing a solution.enter image description here
NOTE: Same piece of code works in chrome browser. Issue is with IE11 when run in Perfecto.

Selenium Web Driver using PHPUnit to open a currently firefox window from a link

I am using selenium web driver using phpunit, the problem I am facing right now is that I have a link button and when I click this button the current link is opened in a new page and I have no idea about how to oen the currently opened new page, can some one help me about how can I code in PHPUnit to open the currently new opened page
Use "WindowHandles" in PHPunit function
Here is the solution to navigate between the tabs:
If there are two opened tabs in your browser and you want to switch to the next tab, below code will work:
$window_handles = $this->windowHandles();
$this->window($window_handles[1]);
And if you want to switch back to the previous tab just change the index as shown below :
$window_handles = $this->windowHandles();
$this->window($window_handles[0]);

Capturing a newly opened window with Selenium

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/")