Selenium Webdriver在IE8上找不到元素 [英] Selenium Webdriver can't find elements on IE8
问题描述
这是我现在面临的一个奇怪的问题.
Here's a strange issue I'm facing right now.
Firefox驱动程序在我的网页中找到一个元素,但是IE驱动程序没有.我认为这取决于浏览器以不同方式处理xpath,但这似乎不是我的问题:尝试通过id,name查找元素,而IE驱动程序会失败.
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.
这使我相信html可能不是一个正确构建的html.我又一次错了,它的结构非常好,如果我将网页另存为html并在保存的html文件中尝试使用硒的按ID或按名称,则可以正常工作!
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!
它在我的网页上不起作用.仅供参考,它已启用SSL.我只是不敢相信这可能会导致问题,原因是它在 https://www.google.com 上找到了元素轻松.有人有什么建议吗?
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?
推荐答案
可能是元素存在于不是父框架的框架中.如果是这样,则必须在确定框架中的元素之前切换到框架.
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.
这篇关于Selenium Webdriver在IE8上找不到元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!