简体   繁体   English

通过Jenkins作为Windows服务运行Selenium脚本时,浏览器未最大化

[英]Browser is not maximized when running selenium scripts via Jenkins as windows service

I am running my selenium scripts written in Java using chromedriver on Windows Server 2008 R2 Server VDI (acting as slave) and have done the setup as windows service. 我正在Windows Server 2008 R2 Server VDI(充当从属服务器)上使用chromedriver运行用Java编写的硒脚本,并已完成了Windows服务的设置。 Problem is browser size is coming as(1036, 780) with no browser getting opened on UI during execution. 问题是浏览器大小即将变为(1036,780),执行期间没有在UI上打开浏览器。 If I run the same script on local (not via Jenkins), then the browser size would be (1554, 843) and hence the reason script is getting failed as it's not able to find the element id. 如果我在本地(而不是通过Jenkins)运行相同的脚本,那么浏览器的大小将为(1554,843),因此原因脚本由于找不到元素ID而失败。

I've tried the options below but nothing worked out for me till now. 我已经尝试过以下选项,但到目前为止没有任何结果。

1) Tried to maximize the browser using the below code but still the browser size didn't changed. 1)尝试使用以下代码最大化浏览器,但浏览器大小并未更改。

Dimension d = new Dimension(1554,843);
//Resize current window to the set dimension
driver.manage().window().setSize(d);

2) Tried to run in fullscreen mode using below code. 2)尝试使用以下代码在全屏模式下运行。

driver.manage().window().fullscreen();

3) On VDI (slave), in services.msc, selected the check box 'Allow service to interact with desktop' but no result 3)在VDI(从站)上,在services.msc中,选中“允许服务与桌面交互”复选框,但没有结果

4) Tried to launch slave using Windows scheduler but even in this case script failed and no browser was opened on UI. 4)尝试使用Windows调度程序启动从属服务器,但即使在这种情况下,脚本也失败,并且没有在UI上打开浏览器。 Referred below link. 参考以下链接。

https://wiki.jenkins.io/display/JENKINS/Launch+Java+Web+Start+slave+agent+via+Windows+Scheduler https://wiki.jenkins.io/display/JENKINS/Launch+Java+Web+Start+slave+agent+via+Windows+Scheduler

My requirement is to run the selenium scripts on the particular VDI (acting as slave) and the reason behind the configuration of Jenkins set up as windows service is, whenever the VDI reboots it automatically establishes the JNLP connection with slave node using slave.jar. 我的要求是在特定的VDI(充当从属服务器)上运行硒脚本,而将Jenkins设置为Windows服务的配置背后的原因是,每当VDI重新启动时,它都会使用slave.jar与从属节点自动建立JNLP连接。

Can anyone suggest me workaround for this problem. 谁能建议我解决此问题。 Thanks in advance. 提前致谢。

尝试使用:

webdriver.maximize_window()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在通过Jenkins作为Windows服务运行时无法最大化浏览器 - Unable to Maximize browser when running through Jenkins as windows service 从Jenkins在Windows VM中运行Selenium Test时无法打开浏览器 - Unable to Open Browser when running Selenium Test in Windows VMs from Jenkins 当我通过Jenkins运行Selenium脚本时,未在Jenkins服务器中实例化浏览器,但我的Jenkins构建已通过 - When I run my selenium scripts through Jenkins, browser was not instantiated in Jenkins server but my Jenkins build was pass 从渲染器接收消息超时:600.000 当我们使用 Jenkins windows 服务模式执行 selenium 脚本时 - Getting Timed out receiving message from renderer: 600.000 When we execute selenium scripts using Jenkins windows service mode 使用tomcat设置的jenkins运行selenium测试时浏览器不可见 - Browser not visible when running selenium test with jenkins set up with tomcat 当 Jenkins 运行测试时,无法看到浏览器上正在运行 Selenium 测试 - Unable to see Selenium tests are running on the browser when the test is run by Jenkins Jenkins在不打开浏览器的情况下运行selenium测试 - Jenkins running selenium tests without opening browser Selenium 代码在 Jenkins 服务器作为作业运行 selenium 代码时未打开 firefox 浏览器 - Selenium code is not opening firefox browser when running selenium code in Jenkins server as Job Selenium是否需要最大化的浏览器窗口? - Does Selenium require maximized browser window? Webdriver Selenium中是否存在浏览器最大化的模式,而实际上却最小化了? - Is there 'as if' maximized mode of browser in Webdriver Selenium, but in reality minimized?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM