How to run a Selenium test from remote computers

2019-04-17 21:16发布

I have written a test for a website with Selenium, now my coworkers ask me to share it on our internet so that they can have access to the test, what they want is to enter a URL on their broswer and my application starts and opens the test on their computers. I have used RESTFUL but I have two issues:

1) When I use my computer IP instead of "localhost"

server = HttpServerFactory.create("http://198.53.63.200:9998/");

it does not work, I mean it does not work even on my own computer

2) I do not know that if I get it work on other computers will it open the test browser on theirs or on mine

2条回答
女痞
2楼-- · 2019-04-17 21:50

Go with Selenium Grid. Check this to run selenium test from remote PC,

查看更多
何必那么认真
3楼-- · 2019-04-17 21:53

This is possible using Selenium Grid as there is server-client relationship that needs to be established before you can run the tests. The client machine should have the selenium server running before it can run the tests. Using your application(server), create a URL that will trigger the test run on a client machine.

Now, you will have a HTTP request from client and server take the client's IP address and browser values. You need to do below things:

  • Setup grid on your server machine.
  • The client should create a node with server as a hub before entering the URL.
  • Run the tests from server on node denoting client machine.

Hope it solve your problem. Let me know if you have any issues.

查看更多
登录 后发表回答