硒的webdriver C#多线程 [英] selenium webdriver C# multithreading

查看:144
本文介绍了硒的webdriver C#多线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请问硒的webdriver支持多线程呢?

Does Selenium WebDriver support multithreading well?

我想有几个窗口都使用它打开了2-4,它看起来像浏览器窗口(Firefox)的获取。有时冻结

I'm trying to use it with several windows opened 2-4, and it looks like browser window (Firefox) gets freezed sometimes.

当一个线程启动:

_driver.FindElement(By.Id(id)).SendKeys("MyMessage");

和在同一时间另一个线程试图获取另一个页面元素的状态。

And another thread at the same time tries to get another page element state.

如何处理的机智呢?

是否有从不同的线程访问同一页面中的任何recomendations?

Are there any recomendations on accessing the same page from different threads?

如何加快SendKeys方法,而不是让硒访问页面,同时的SendKeys还没有完成?

How to speed up the SendKeys method, and not allow selenium to access the page while SendKeys still not finished?

推荐答案

在我的经验中,硒的webdriver支持多线程相当好(除非你使用IE浏览器)。
从你的代码,它看起来像您正在使用相同的驱动程序实例所有的线程 - 确保每个线程都有自己的webdriver例如

In my experience, Selenium WebDriver supports multithreading quite well (unless you're using IE). From your code, it looks like you are using the same driver instance in all of your threads - make sure each thread has its own WebDriver instance.

这篇关于硒的webdriver C#多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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