我的问题是:如何指定应该在Grid服务器上执行代码的Windows用户帐户?据我所知,我可以添加到RemoteWebDriver的两个参数是远程服务器的主机名(或IP)和端口.我看不到任何选项来指定应在哪个Windows用户帐户下运行.由于远程服务器下所有Windows用户帐户的主机名(IP)都相同,我如何告诉集线器"每次在不同Windows用户帐户下执行代码段?我看到的唯一可能性是在不同的端口下运行Selenium Grid的每个实例,并使用端口号作为区分两个Windows用户帐户的方式(并确保我同时登录了两个用户帐户)时间).例如,我可以在"account639"上设置Selenium Grid以侦听端口6399,例如在"account729"上侦听端口"7299"-这样,我知道代码是在适当的Windows帐户下执行的这可行吗?还有没有使用端口的更直接方法(例如,是否可以指定集线器应该连接到哪个Windows用户帐户,就像我指定端口一样?)解决方案以每个Windows用户身份登录,并在不同端口上的每个帐户下运行一个硒节点(例如:5555、5556、5557).如果每个节点都具有相同的设置,则意味着相同的浏览器,相同的浏览器版本等,您可以使用"applicationName",这是受支持的但未记录在文档中的额外功能.使用此功能,您可以区分您的节点.例如,在您的nodeConfig中:...{ "applicationName":"account639", "platform":"WINDOWS", "browserName":"chrome", "maxInstances":5, "version":"40", "seleniumProtocol":"WebDriver"},...之后,您可以设置RemoteWebDriver以在属于特定寡妇用户帐户的特定节点上运行测试.例如:DesiredCapabilities dc = new DesiredCapabilities();dc.setCapability("applicationName", "account639");...WebDriver driver = new RemoteWebDriver(new URL(this.getHubUrl()), dc);如果您想使用更多的额外功能,则可以创建自己的自定义功能匹配器(在Google中搜索:"Selenium grid自定义功能匹配器"),但是如果您只需要一个额外的功能,我建议您使用提到一个.希望这会有所帮助.I have an application written in Java that creates an email account on a specific website. For certain reasons, I need to run each iteration of the program under a different windows user account.I'm using Selenium Grid (RemoteWebDriver) to connect to a remote server (Grid) from a hub server.Assuming I have multiple windows user accounts set up on a remote windows server (such as "account639", "account729", "account889" etc) and I want my hub to connect to each account separately and execute Java codeMy question is: How do I specify which windows user account the code should be executed on in the Grid server?As far as I can tell, the two parameters I can add to RemoteWebDriver is the hostname (or IP) of the remote server and the port. I don't see any option to specify which windows user account it should run under.Since the hostname (IP) is the same for all windows user accounts under the remote server how would I tell the "hub" to execute the section of code under a different windows user account each time?The only possibility I see is to run each instance of Selenium Grid under a different port and use the port number as a way to differentiate between two windows user accounts (and make sure I'm logged into both user accounts at the same time).For example, I could setup Selenium Grid on "account639" to listen on port 6399 for example and "account729" to listen on port "7299" for example - this way I know the code is being executed under the appropriate windows account.Is this feasible? And is there a more direct way of doing this without using ports (i.e, is it possible to specify which windows user account the hub should connect to just like I specify the ports?) 解决方案 Log in with every windows user and run a selenium node under every account on different ports (for example: 5555, 5556, 5557).If every node has the same setup, I mean the same browser, same browser versions, etc... you can use "applicationName", which is a supported but not documented extra capability. With this capability, you can distinguish your nodes. For example in your nodeConfig:...{ "applicationName":"account639", "platform":"WINDOWS", "browserName":"chrome", "maxInstances":5, "version":"40", "seleniumProtocol":"WebDriver"},...After that you can set up your RemoteWebDriver to run your tests on a specific node which belongs to a specific widows user account. For example:DesiredCapabilities dc = new DesiredCapabilities();dc.setCapability("applicationName", "account639");...WebDriver driver = new RemoteWebDriver(new URL(this.getHubUrl()), dc);If you want to use more extra capability, you can create your own custom Capability Matcher (search for it in Google: "selenium grid custom capability matcher"), but if you need only one extra capability, I recommend to use the mentioned one.Hope this helps. 这篇关于Selenium Grid和RemoteWebDriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-18 16:52