How to kill thread in a Selenium Grid node

别来无恙 提交于 2019-12-02 10:00:31

Personally, I wouldn't use ThreadLocal . I would just use protected member variables, having protected WebDriver being a member of a TestBase class. Then, once your session is started on the grid, make your test remember the session ID, then if there is an error, you can kill the Grid thread by sending a command to quit the driver along with the session id for that thread. I would basically be a JSON request. JSON wire protocol has a delete command that looks like this:

DELETE /session/:sessionId

By using ThreadLocal, in my opinion you are using something that is meant to handle local threads and trying to apply that concept to a remote service that has its own thread handling in it already. I guess I never use ThreadLocal because my testrunner does the thread forking for me: TestNG.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!