Selenium Webdriver can't find elements on IE8

2019-04-16 05:41发布

问题:

Here's a strange issue I'm facing right now.

The Firefox driver locates an element in my webpage however my IE driver doesn't. I thought it would be down to browsers handling the xpaths differently, but that doesn't seem to be my problem: trying to find elements by id, name and everything else fails with the IE driver.

This lead me to believe that the html might not have been a properly constructed one. I was wrong again, it was very well constructed and if I saved the webpage as html and tried with selenium's By id or By name on the saved html file, it worked!

It just won't work on my webpage. FYI, it's SSL enabled. I just can't believe that could be causing issues cos it finds elements on https://www.google.com with ease. Anyone have any suggestion?

回答1:

May be the elements are present in a frame which is not the parent frame. If so, you've to switch to the frame before identifying the elements in it.

Check out the link for more information



回答2:

protected mode settings in security tab should be same for all the four. I also had same problem, its working now after I enabled protected mode for all the four zones.



回答3:

It's bit weird...but can you check by enabling the "Compatibility mode"

Enable Compatibility Mode

1) Tools->Compatibility view Settings

2) Check the Display all sites in compatibility view.

I hope it helps...all the best :-)



回答4:

if you are using Internet explorer, behind a firewall, you might want to add in your security option, in local intranet, sites, advance setting, then, add your web adress.

For me it work