Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/282.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# 在c中使用新版本的chromedriver、chrome和selenium时出现单击问题#_C#_Selenium_Selenium Chromedriver - Fatal编程技术网

C# 在c中使用新版本的chromedriver、chrome和selenium时出现单击问题#

C# 在c中使用新版本的chromedriver、chrome和selenium时出现单击问题#,c#,selenium,selenium-chromedriver,C#,Selenium,Selenium Chromedriver,我使用的是最新的chrome 77.0.3865.90 我试过chromedriver版本-77.0.3865.4000、76.0.3809* 代码是C语言的# 我在页面上找到一个元素并点击它。这过去工作正常,我想在新的chrome浏览器更新(到77.0.3865.90)后,我会因为点击而出现以下错误: 未知错误:无法分析getElementRegion的值\n(会话信息:chrome=77.0.3865.90)“} 我尝试使用多个chromedriver版本,如上所述,似乎没有任何效果

我使用的是最新的chrome 77.0.3865.90 我试过chromedriver版本-77.0.3865.4000、76.0.3809* 代码是C语言的#

我在页面上找到一个元素并点击它。这过去工作正常,我想在新的chrome浏览器更新(到77.0.3865.90)后,我会因为点击而出现以下错误:

未知错误:无法分析getElementRegion的值\n(会话信息:chrome=77.0.3865.90)“}

我尝试使用多个chromedriver版本,如上所述,似乎没有任何效果

            WebDriverWait wait = new WebDriverWait(Driver, new TimeSpan(0, 0, 30));
        wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("imgSearchReceiver"))).Click();

使用
Thread.sleep(4000)
。有时
WebDriverWait
对某些需要等待的元素不起作用,睡眠是最好的解决方案。

将Selenium Extras加载到您的解决方案中

var wait = new WebDriverWait(driver, new TimeSpan(0, 0, 30));
var element = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Id("imgSearchReceiver")));

很少有时候应该使用线程睡眠。我见过接近1000个线程睡眠的解决方案,从时间的角度来看,它会扼杀自动化的运行。等待元素可见比使用线程睡眠更好。Raj-如果调试它,会发生什么事?好吧,有些情况下会等到visib元素不可用,我知道Thread.sleep是最后一个选项。感谢您的回复。我的原始代码使用sleep,但不可用,因此我将其更改为此…因此无论哪种方式都不可用。请帮助!!!您能在原始邮件中剪切并粘贴html吗?