Problems launching selenium in Internet Explorer

Hi, I am trying to run my selenium webdriver on IE9.

  • WebDriver Version: 2.32.0
  • IE: 9
  • IEDriverServer_win32: 2.32.3
  • windows7

Below is my code:

File IEDriver=new File(System.getProperty("user.dir")+File.separator+"BrowserDrivers"+File.separator+"IEDriverServer.exe"); System.setProperty("webdriver.ie.driver", IEDriver.getAbsolutePath()); DesiredCapabilities cap=DesiredCapabilities.internetExplorer(); cap.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); WebDriver driver=new InternetExplorerDriver(cap); driver.get("http://in00616:8421/GS"); Thread.sleep(3000); //driver.findElement(By.id("j_username")).sendKeys("admin"); //driver.findElement(By.id("j_password")).sendKeys("admin"); driver.findElement(By.xpath(".//input[@id='j_username']")).sendKeys("admin"); driver.findElement(By.xpath(".//input[@id='j_password']")).sendKeys("admin"); driver.findElement(By.id("login")).submit(); Thread.sleep(2000); driver.findElement(By.xpath(".//button[text()='Securities']")).click(); Thread.sleep(2000); driver.findElement(By.xpath(".//span[text()='Issue']")).click(); Thread.sleep(2000); driver.findElement(By.id("tabSecurities_Issue_Request_for_Issues")).click(); 

The above code is registered on my website, but then when I try to click the "Securities" button, I can not do this. The Securities button starts to flicker, and then I get a notification that I canโ€™t find the item.

An exception in the stream "main" org.openqa.selenium.NoSuchElementException: Could not find an element with xpath ==. // span [text () = 'Issue Type'] (WARNING: the server did not provide any information about the stack) -

The same code works fine in FireFox.

Please help, as I can test my interface on InternetExplorer. I think this is a version compatibility issue. Someone can offer a compatible version for IEDriverServer, Selenium WebDriver and IE, which is in working condition.

+4
source share
3 answers

Hi everyone, I found out that this is a Selenium Webdriver 2.32 issue with IEDriver_Server2_32. After checking the permutation and combination with the latest available versions of webdriver and IEDriver_Server, I found a suitable stable configuration to work on IE9 below, this is a stable configuration: Webdriver: 2.33.0 IEDriver_Server: 2.33.0. There is still a small problem, but I'm trying to find a workaround. Problem. In IE, if any control tooltip overlaps another control than IE cannot detect this control. I think this problem is related to IE. IE uses nativeEvents to perform the operation, so it cannot find this control. In FF, he can recognize this control and is working fine. Thanks to everyone.

0
source

As this answer, SO indicates that IE does not have native XPath support. Instead, Selenium WebDriver uses the old third-party xpath library when using IE. Firefox has integrated XPath support, so your selectors work fine in this browser.

I would strongly recommend that you update your selectors instead of using CSS selectors. They are supported in all browsers, they are easier to read, understand and pick up, and they are pretty fast.

You can learn more about how to use the CSS selector from several different tuturials here , here , and here , and CSS selector cheats .

Also, whenever possible, try not to select an item based on the text contained in it. If you can select an element by its identifier, class, other attribute, or even through a DOM chain (that is, "div.1> div.2> span.a> ab"), it is better than trying to select an element by text.

+2
source

Webdriver is having difficulty using IE with locators. Murnal seems to have difficulty using a CSS locator. My advice: you should use other locators if they do not work. This problem occurs again and again when using a browser without a Firefox browser. In the meantime, an easier way to find an alternative locator is to use the Selenium IDE Firefox, where you enter the command, you will see that it also provides an alternative locator. Copy this and try connecting it to your script web application.

0
source

Source: https://habr.com/ru/post/1482114/


All Articles