如何从远程计算机运行Selenium测试 [英] How to run a Selenium test from remote computers

查看:295
本文介绍了如何从远程计算机运行Selenium测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用Selenium为一个网站编写了一个测试,现在我的同事要求我在我们的Internet上共享它,以便他们可以访问该测试,他们想要的是在浏览器中输入URL,然后我的应用程序启动并在他们的计算机上打开测试.我使用过RESTFUL,但是有两个问题:

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)当我使用计算机IP代替本地主机"时

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)我不知道如果我能在其他计算机上使用它,它将在他们的计算机上还是在我的计算机上打开测试浏览器

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

推荐答案

使用 Selenium Grid ,因为您需要先建立服务器-客户端关系,然后才能运行测试.客户端计算机应在运行硒服务器之前运行测试.使用您的应用程序(服务器),创建一个将触发在客户端计算机上运行测试的URL.

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.

现在,您将收到来自客户端和服务器的HTTP请求,其中包含客户端的IP地址和浏览器值.您需要做以下事情:

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:

  • 在服务器计算机上设置网格.
  • 客户端应在输入URL之前创建一个以服务器为中心的节点.
  • 从表示客户端计算机的节点上的服务器运行测试.

希望它可以解决您的问题.让我知道您是否有任何问题.

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

这篇关于如何从远程计算机运行Selenium测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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