1

So I am writing a class in eclipse using selenium and autoitx4java libraries, now I have been having an issue that I believe is selenium specific (meaning having nothing to do with autoIt).

Basically when I arrive at the splash page for the website I am attempting to test, the first thing I do is find the element for the login page via XPath, and click on it using the click() method. This is supposed to open up a certificate window.

Once the click() method runs a certificate window comes up, however, for some reason the selenium test does not keep running lines of code. Instead it pauses at the line the click function was executed. The code looks a bit like this:

WebElement login = driver.findElement(By.xpath("example_xpath"));

login.click();
// login.sendKeys(Keys.ENTER);
System.out.println("login clicked");

Class.selectCert();

(Where "Class" is just a class created for this specific test.)

So when the code is run in Selenium, the line "login clicked" is never printed out. As you can see, the alternate sendKeys(Keys.ENTER) function has been tried. When I used this function, literally nothing happened, and the code continued as if that line of code did not exist.

Note: When I highlight the element and manually press ENTER, the certificate window actually pops up.

This is where things get weird. When I remove the line for the click function, and replace it with a pause() function which gives me ample time to click on the element manually. The code runs perfectly fine, the "login clicked" is printed out, and the certificate window is handled by the autoIt code I have in the selectCert() function.

I have tried clicking on different elements on the screen, and so far this bug only occurs when clicking on elements that have an xpath with /img at the end of it. Not sure if that helps at all... Any help would be appreciated!

Kibbles
  • 11
  • 2
  • Does the program "hang up" forever or do you eventually get an error message/stacktrace? It's not due to a lack of a `WebDriverWait` since the certificate window pops up when you highlight the element and manually press enter. – JaneGoodall Jun 09 '15 at 17:20
  • @JaneGoodall So the program basically gets stuck in limbo and does not report anything via terminal etc. I've actually found a "solution" to the problem (which I don't think I'll mark as such) which just commands the script to go to the link that the login takes you to after you've entered in a certificate. If you do this without first entering certificate info, then the certificate window pops up and I can interact with it fine... which is interesting. – Kibbles Jun 10 '15 at 13:09
  • Out of curiosity, can you send Keys.RETURN instead of Keys.ENTER with your pre-"solution" code? I'll write a formal answer if that works. http://stackoverflow.com/a/22924255/2167210 – JaneGoodall Jun 11 '15 at 18:41
  • @JaneGoodall Sorry I did not get back to you, but I have tried both Key.RETURN and Keys.ENTER. Thanks for asking though. – Kibbles Jun 18 '15 at 18:51

0 Answers0