Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

getWindowHandles() not working while using ChromeDriver #2833

Closed
lukeis opened this issue Mar 3, 2016 · 8 comments
Closed

getWindowHandles() not working while using ChromeDriver #2833

lukeis opened this issue Mar 3, 2016 · 8 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 2833

Steps to reproduce the problem.

1.When i open a link with following href 

href="javascript:document.forms['confluence_loginform'].submit();"

it takes me to a page that is on different domain and opens in new tab.

The url for the link is generated from an attribute in form tag and the credentials
are taken from input tag attributes.

Expected Output: getWindowHandles() should return set of window handles.

Actual Output: script gets stuck as soon as i use  driver.getWindowHandles(). The statements
next to it dont get executed.
I am unable to switch to new tab with ChromeDriver.

NOTE: The problem is only with ChromeDriver. I tried running the same script using
FirefoxDriver and it works fine and i am able to switch to new tab and perform actions
on it.




Selenium version:Tried on  2.3.0 , 2.7.0 and 2.11.0
OS:Windows 7
Browser:Chrome 
Brower version:14



Reported by aditya.dhingra89 on 2011-11-14 11:38:36

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Instead of describing how the page in question behaves, it would be useful if you could
provide a reduced example (HTML/JS/CSS + WebDriver code) that will let us reproduce
the problem. We have tests for getWindowHandles that are happily passing with Chrome,
so this isn't a general problem. 

Reported by jari.bakken on 2011-11-14 12:35:33

  • Status changed: NeedsClarification
  • Labels added: Component-WebDriver, Browser-Chrome

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I have created small sandbox for you to understand the issue.
Kindly find the link below.

http://testchromedriver.herobo.com/test.html

When i click on the 'Gmail link' on the page it takes me to Gmail login page which
gets opened in new tab. And I am not able to switch to that tab and even getWindowHandles()
doesn't show anything when i try to print the set and the program gets stuck as soon
as I use getWindowHandles(). But that problem is only with ChromeDriver.It works perfectly
fine with FirefoxDriver. 

Reported by aditya.dhingra89 on 2011-11-30 10:45:40

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

This is the WebDriver code that I am using :-
    WebDriver driver = new ChromeDriver();
    driver.get("http://testchromedriver.herobo.com/test.html");
    driver.findElement(By.tagName("a")).click();
    Thread.sleep(5000);
    Set<String> windows = driver.getWindowHandles();
    System.out.println(windows);
    driver.quit();

Reported by aditya.dhingra89 on 2011-11-30 12:01:13

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by dawagner on 2011-12-19 14:28:14

  • Status changed: New

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by kkania@google.com on 2011-12-19 17:26:57

  • Status changed: Accepted

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Update: ChromeDriver gets stuck after clicking the particular anchor tag.

HTML to reproduce the problem: 
<a href="javascript:document.forms['gmail_login'].submit();">Gmail Login</a>

<form target="_blank" style="display:none;" name="gmail_login" method="POST" action="https://mail.google.com">

Reported by aditya.dhingra89 on 2012-02-28 07:31:40

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Moved to: Issue chromedriver:111

Reported by kkania@google.com on 2012-07-16 19:39:29

  • Status changed: Moved

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:14:09

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant