Jenkins开始使用硒,但无法访问chrome localStorage [英] Jenkins started selenium, but can't access chrome localStorage

查看:738
本文介绍了Jenkins开始使用硒,但无法访问chrome localStorage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Jenkins以铬驱动程序启动硒独立服务。它开始OK。但是当我在实习生测试中使用它时,铬测试不会开始。我在日志中得到了这个:

I use Jenkins to start a selenium standalone serve with chrome driver. It starts OK. But when I use it with intern tests, the chrome tests don't start. I got this in the log:

org.openqa.selenium.WebDriverException: 
unknown error: Runtime.evaluate threw exception: 
DOMException: Failed to read the 'localStorage' property from 'Window': 
Access is denied for this document.

如果我在本地启动selenium,一切正常。注意Jenkins奴隶服务使用与本地登录相同的用户。

If I start selenium locally, everything works fine. Note Jenkins slave service uses the same user as the local login.

我用来启动Jenkins的Ther批处理脚本是这样的:

Ther batch script I used to start Jenkins is this:

start cmd /c java -jar C:\Jenkins\workspace\app\util\selenium-server-standalone-2.44.0.jar -Dwebdriver.chrome.driver=C:\Jenkins\workspace\app\util\chromedriver.exe 2^> seleniumLog.txt

为什么当我从Jenkins启动硒时无法工作?

Why does it not work when I start selenium from Jenkins?

推荐答案

如果您使用Jenkins作为服务,独立服务器无法创建真实窗口。

If you use Jenkins as a service standalone server can't create real window.

您可以使用解决方法。创建节点并从普通用户运行(自动启动)。在该节点上运行你的作业

You can use workaround. Create Node and run from usual user (auto startup). Run your Job on that node

PS

对于正常的屏幕截图(不是黑屏)控制台tscon RDP-tcp#0 / dest:console(通过QRes工具设置屏幕分辨率)。

For normal screenshot (not black screen) you can put session to Console "tscon RDP-tcp#0 /dest:console" (set screen resolution by QRes tool).

这篇关于Jenkins开始使用硒,但无法访问chrome localStorage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆