Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Selenium Click在Windows10 IE11中不起作用_C#_Selenium Webdriver_Selenium Iedriver - Fatal编程技术网

C# Selenium Click在Windows10 IE11中不起作用

C# Selenium Click在Windows10 IE11中不起作用,c#,selenium-webdriver,selenium-iedriver,C#,Selenium Webdriver,Selenium Iedriver,我们在C#中使用Selenium,但是Selenium的点击功能在Windows 10 IE11中不起作用,如果我使用的是Javascriptexecutor,那么它就起作用了, 但我的要求不是使用Javascriptexecutor ((IJavaScriptExecutor)seleniumuiDriver.webDr).ExecuteScript("return document.querySelectorAll(arguments[0])[0].click();", identifier

我们在C#中使用Selenium,但是Selenium的点击功能在Windows 10 IE11中不起作用,如果我使用的是Javascriptexecutor,那么它就起作用了, 但我的要求不是使用Javascriptexecutor

((IJavaScriptExecutor)seleniumuiDriver.webDr).ExecuteScript("return document.querySelectorAll(arguments[0])[0].click();", identifier.Split('$')[0]); ((IJavaScriptExecutor)seleniumuiDriver.webDr).ExecuteScript(“返回文档.查询选择器所有(参数[0])[0]。单击();”,标识符.Split(“$”)[0]); 当我使用Javascriptexecutor时,我不能使用ID、Xpath、Name。我只能使用CssSelector。在IE11中有什么方法可以使用 不带Javascriptexecutor的windows 10

Selenium版本:2.49


编程语言:C#

我在python和selenium中遇到了这个问题。我的解决方法是使用find_element_by//设置一个变量,并在javascript中调用它。这样,您就可以随心所欲地识别元素,javascript仍然能够读取它

下面是我所说的一个示例(同样,这是python,但语法切换不应该是一个太大的问题:

nextPage = driver.find_element_by_xpath("//button[contains(text(),'2')]")
driver.execute_script("arguments[0].style.visibility = 'visible'; arguments[0].click();", nextPage)

@IE驱动程序RyanWilson很差劲,因为我想负责大部分代码的开发人员的能力不是很强。但是,我知道他总是愿意参加关于具体想法的讨论,以使其更好。你是否尝试过让开发人员参与(完全是自愿的,并且没有报酬的)开发团队?@JimEvans我听说这不是特别好,因为微软,而不是与Selenium有关的开发团队。事实上,几乎所有来自Selenium团队的其他驱动程序都是一流的。@JimEvans我想为这一评论道歉,我知道在某些事情上努力工作并拥有某些东西是什么感觉我不欣赏。我写这篇文章时没有考虑到这一点。我知道你努力工作,以帮助提供一个好的产品,正如你所指出的是免费的。正如我在之前的评论中所说,我相信我在IE驱动程序方面遇到的一些问题更多地与微软没有与Selenium团队合作有关,而不是与任何类型的问题有关Selenium开发团队的无能。我想说谢谢Jim,感谢你和团队所做的所有辛勤工作。有没有不使用javascriptexecutor的解决方案?如果元素不可见,我不这么认为。我可能错了,但一直都是因为web元素在我必须将其传递到Java时不可见在那些试图阻止你编写脚本和实现自动化(尤其是社交媒体)的平台上,这比没有的情况要多。