Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.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
Maven 使用selenium与不可见元素交互_Maven_Selenium_Selenium Webdriver - Fatal编程技术网

Maven 使用selenium与不可见元素交互

Maven 使用selenium与不可见元素交互,maven,selenium,selenium-webdriver,Maven,Selenium,Selenium Webdriver,在为我的应用程序实施最终用户登录测试时,通过LinkedIn登录时,我遇到以下错误: “元素当前不可见,因此可能无法与之交互。” 在cmd提示符下通过maven执行测试套件时出现此错误。尽管测试通过Firefox selenium插件完美运行 我尝试最大化我的窗口,这也不起作用。请帮助。只需使用下面的命令而不是WebElement click进行尝试 WebElement element=driver.findElement(By.cssSelector("span[name='test']")

在为我的应用程序实施最终用户登录测试时,通过LinkedIn登录时,我遇到以下错误: “元素当前不可见,因此可能无法与之交互。”

在cmd提示符下通过maven执行测试套件时出现此错误。尽管测试通过Firefox selenium插件完美运行


我尝试最大化我的窗口,这也不起作用。请帮助。

只需使用下面的命令而不是WebElement click进行尝试

WebElement element=driver.findElement(By.cssSelector("span[name='test']"));
new Actions(driver).click(element).perform();

我刚刚为Authorize按钮输入了一个assertElementPresent命令,它开始检测按钮,我就可以提交了。

如果元素通过ajax加载,您可以尝试等待它显示出来。问题不在于等待时间,我需要与之交互的元素超出了可视窗口的范围,这使得selenium无法看到它们。您是否尝试过通过驱动程序或Java脚本滚动页面?