在使用Selenium Grid和.net的特定计算机上,Chromedriver非常慢 [英] Chromedriver is extremely slow on a specific machine using Selenium Grid and .net

查看:208
本文介绍了在使用Selenium Grid和.net的特定计算机上,Chromedriver非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

概述: Chromedriver在一台机器上正常工作,但在另外两台相同的机器上工作极慢.

Overview: Chromedriver works normally on one machine but extremely slowly on two other identical machines.

设置:

  • Selenium Webdriver,使用.Net进行编码,并使用Selenium Grid分发测试.为了运行测试,正在Visual Studio 2010中使用MSTest.
  • 充当Hub的64位Windows 7本地计算机
  • 我的本​​地网络上的三台32位Win 7远程计算机(其中两台是虚拟的)都配置为节点.这是用于启动远程计算机上的节点的命令:

  • Selenium Webdriver using .Net for coding and Selenium Grid for distributing the tests. MSTest is being used from within Visual Studio 2010 in order to run the tests.
  • A 64bit Windows 7 local machine acting as the Hub
  • Three 32-bit Win 7 remote machines (two of them are virtual) on my local network all configured as nodes. Here is the command used to start the nodes on the remote machines:

java -jar c:\ seleniumWebDriver \ seleniumGrid \ selenium-server-standalone-2.31.0.jar-角色节点-hub http://XXX.XXX.XXX.XXX:4444/grid/register -浏览器"browserName = chrome",maxInstances = 4 -Dwebdriver.chrome.driver ="C: \ seleniumWebDriver \ chromedriver.exe"

java -jar c:\seleniumWebDriver\seleniumGrid\selenium-server-standalone-2.31.0.jar -role node -hub http://XXX.XXX.XXX.XXX:4444/grid/register -browser "browserName=chrome",maxInstances=4 -Dwebdriver.chrome.driver="C:\seleniumWebDriver\chromedriver.exe"

从代码中这样启动驱动程序:

The driver is launched like this from within the code:

DesiredCapabilities功能=新的DesiredCapabilities(); Capacity.SetCapability(CapabilityType.BrowserName,browser); 驱动程序=新的RemoteWebDriver(新的Uri(hubUrl),功能);

DesiredCapabilities capability = new DesiredCapabilities(); capability.SetCapability(CapabilityType.BrowserName, browser); driver = new RemoteWebDriver(new Uri(hubUrl), capability);

上面的变量浏览器"和"hubUrl"通过运行时生成的app.config文件传递.对于这种情况,请使用browser = chrome.

The variable "browser" and "hubUrl" above is passed via an app.config file that is built at runtime. For this case, browser=chrome.

问题:

  • 当我使用上面的命令将计算机212(作为虚拟机)设置为chrome节点,然后从集线器启动脚本时,我看到chrome在适当的远程计算机中启动并正常运行.每秒可显示5-10个命令.

  • When I setup machine 212 (which is a virtual machine) as a chrome node using the command above, and then launch the scripts from the hub, I see chrome start in the proper remote machine and run normally. It fields between 5-10 commands per second.

当我以相同的方式将机器78(虚拟机)或机器103(真实机)设置为节点,然后从集线器启动脚本时,我看到该节点可以正常启动chrome.但是,它运行非常缓慢,就像每秒1条命令或更少.

When I setup either machine 78 (virtual machine) or machine 103 (real machine) as a node in the same manner, and then launch the scripts from the hub, I see the node start up chrome properly. However, it runs extremely slowly, like 1 command per sec or less.

其他信息: 就像我说的,Chrome在一台机器上正常工作,但是在其他机器上,运行速度却非常慢.将Firefox和IE配置为节点后,它们可以正常工作.

Other info: Like I said, on one machine chrome works normally, but on the others, runs extremely slowly. Firefox and IE, when configured as nodes, work normally.

我已经将机器212(正常工作)与其他机器进行了比较,但找不到差异.所有机器都使用"selenium-server-standalone-2.31.0.jar"和相同版本的ChromeDriver.

I have compared the machine 212 (which works properly) with the other machines and cannot find the difference. All the machines are using 'selenium-server-standalone-2.31.0.jar' and the same version of the ChromeDriver.

似乎节点计算机没有过载.而且,这是性能上非常一致的差异,似乎与网络或计算机上的任何波动的负载无关.

It does not appear that the node machines are being overloaded. Also, it is a very consistent difference in performance which does not seem related to any fluctuating load on the network or the machines.

我的网络技术人员已验证所有这些计算机在网络上的配置均相同.

My network tech has verified that all these machines are configured identically on the network.

以前有人看过这样的东西吗?

Has anybody seen anything like this before?

我今天登录,所有三台远程计算机都在缓慢运行chrome.以前其中一个是正常的,但是现在它们都很慢.

EDIT 1: I logged in today and all three remote machines are running chrome slowly. Before one of them was normal, but now they are all slow.

推荐答案

我遇到了一个类似的问题,其中chromedriver在某些计算机上运行缓慢,事实证明这是代理问题.在Chrome://设置>更改代理设置>局域网设置>下禁用自动检测设置",可使Webdriver在chrome中为我更快地执行命令.

I ran into a similar issue where chromedriver was slow in some machines and it turned out to be a proxy issue. Disabling "Automatically detect settings" under Chrome://settings >Change proxy settings> LAN Settings> made webdriver execute commands faster in chrome for me.

这篇关于在使用Selenium Grid和.net的特定计算机上,Chromedriver非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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