无法评估xpath的Selenium 2.0 WebDriver IE8 findelement [英] Selenium 2.0 WebDriver IE8 findelement by xpath cannot be evaluated
问题描述
当我在Firefox中运行以下代码时,它运行正常,但在IE8中,它表示无法评估xpath或不会产生WebElement。
When I run the following code in Firefox it runs correctly, but in IE8 it says xpath cannot be evaluated or does not result in a WebElement.
webDriver.findElement(By.xpath("//input[@id='submitForm']")).sendKeys("\n");
OR
webDriver.findElement(By.xpath("//input[@id='submitForm']")).click();
我试过备用xpath// div [@ id ='parameters'] / table / tbody / tr [4] / th / input但它给出了相同的结果。
I have tried alternate xpath "//div[@id='parameters']/table/tbody/tr[4]/th/input" but it gives same result.
在我看来这是一个IE驱动程序问题,如果有的话请告诉我解决方法。
It seems to me that it is a IE driver problem, please let me know if there is a work around.
推荐答案
你能尝试如下吗?
webDriver.findElement(By.xpath("//input[string(@id)='submitForm']")).click()
对于IE没有本机XPath支持,WebDriver使用名为 javascript-xpath 对此,这可能是它的错误。
For IE doesn't have native XPath support, WebDriver use a third-party library called javascript-xpath for this, this may be a bug of it.
这篇关于无法评估xpath的Selenium 2.0 WebDriver IE8 findelement的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!