Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/315.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# selenium网格并行执行_C#_Java_Selenium Grid - Fatal编程技术网

C# selenium网格并行执行

C# selenium网格并行执行,c#,java,selenium-grid,C#,Java,Selenium Grid,这是来自selenium grid的。如何编写java/C代码来进行并行执行 这够了吗 ISelenium selenium1 = new DefaultSelenium("localhost", 5555, "*iehta", "http://localhost/"); ISelenium selenium2 = new DefaultSelenium("localhost", 5556, "*iehta", "http://localhost/"); ISelenium selenium4

这是来自selenium grid的。如何编写java/C代码来进行并行执行

这够了吗

ISelenium selenium1 = new DefaultSelenium("localhost", 5555, "*iehta", "http://localhost/");
ISelenium selenium2 = new DefaultSelenium("localhost", 5556, "*iehta", "http://localhost/");
ISelenium selenium4 = new DefaultSelenium("localhost", 5557, "*iehta", "http://localhost/");


selenium1.Start();
selenium2.Start();
selenium3.Start();
因为当我运行时,有3个可用的遥控器,但没有活动的遥控器,即使我从上运行代码

来自ant的代码,我不完全理解。为什么有参数


您所做的工作会起作用,但速度会很慢,几乎与真正串行方式一样糟糕。这是因为Selenium中的大多数调用将一直阻塞到完成。为了真正利用网格提供的并行化,您应该多线程地编写代码。每个Selenium对象有一个线程。

为什么有参数

<arg value="-parallel"/>?

您不需要多线程测试代码来并行运行selenium实例(尽管如果您真的愿意,也可以)。处理线程分叉的框架可以为您完成这项工作,例如TestNG、Maven Surefire或Gradle。例如,我的项目通过演示在一台计算机上使用Gradle fork threads/instances在网格中运行的多个实例来证明这一点:

ok我现在为ech selenium对象创建一个线程。但我不认为这会更快,也不认为我错了。怎么看是不是并行执行?答案是thx。这都是真的,但在“主动遥控”下没有RC。这可以吗?一旦开始测试,您应该在“主动远程控制”下看到RCs。你的代码有问题。我已经更新了我的答案。
<arg value="-parallel"/>?
`ISelenium selenium1 = new DefaultSelenium("localhost", 4444, "*iehta",` "http://localhost/");