DevOps | Software Automation | Continuous Integration

Tag: Internet Explorer

IE Does Not Recognise Complex XPath

You may need different code for FireFox and IE. This is because IE does not recognise complex XPath expressions.

For eg:

This will work in FF

driver.FindElement(By.XPath(“/html/body[@id=’ctl00__objBodyTag’]/form[@id=’aspnetForm’]/div[@id=’__Page’]/div[@id=’page’]/div[@id=”]/div/div/div/div[@id=’expandPanelsPersonalDetails’]/div[11]/img[1]”)).Click(); 

In IE it needs to be simplified to:

driver.FindElement(By.XPath(“//div[@id=’expandPanelsPersonalDetails’]/div[11]/img[1]”)).Click();

 

Getting Selenium To Work In Internet Explorer 8

Below are the 3 key things which you need to configure in order for Selenium to work in Internet Explorer 8

  • Tools->Internet Options->Security tab
Set the security level for all zones to high. This is due to all zones have to be on the same level and Restricted Sites can only be set to high.
  • Zoom level to be 100%
  • Tools->Internet Options->Security tab->Custom level->Scripting
Enable Active Scripting. This is required in order for JavaScript to work.

  • Install the correct version of InternetExplorerDriver – depending on how many bits is your machine

© 2023 Chuan Chuan Law

Theme by Anders NorenUp ↑