简体   繁体   English

使用Java的Selenium Webdriver(Eclipse IDE)

[英]Selenium Webdriver using Java(Eclipse IDE)

I have automated a web app using seleinium webdriver in Eclipse IDE. 我已经在Eclipse IDE中使用seleinium webdriver自动化了一个Web应用程序。 I am picking the login credential(other dynamic parameters) from one properties file.The automation is working perfectly fine. 我正在从一个属性文件中选择登录凭据(其他动态参数)。自动化工作得很好。 Now if I want to run the automation in a different machine with different credential. 现在,如果要在具有不同凭据的不同计算机上运行自动化。 Could anyone please guide me on how to create the jar file and run it in a different machine.I should be able to change the parameter as per my requirement. 谁能指导我如何创建jar文件并在其他计算机上运行它。我应该能够根据需要更改参数。

  1. Instead of property file You can keep Your parameters in testNG xml file. 您可以将参数保留在testNG xml文件中,而不使用属性文件。 Even for each and every test also you can configure different parameters. 即使对于每个测试,您也可以配置不同的参数。 Refer : Testng Parameter help document 请参阅: Testng参数帮助文档

  2. And For executing in remote machine You have to look at 'Remote webdriver' in selenium. 为了在远程计算机上执行,您必须查看Selenium中的“ Remote webdriver”。 Selenium Remote Webdriver help document Selenium Remote Webdriver帮助文档

you can read the property file using the below command String propertyFileLocation = System.getProperty("property.file.location"); 您可以使用以下命令读取属性文件:String propertyFileLocation = System.getProperty(“ property.file.location”);

pass the value for "property.file.location" from the command prompt. 从命令提示符处传递“ property.file.location”的值。

You can call your jar file as java -cp jarfilelocation -Dproperty.file.location= classlocation 您可以将您的jar文件称为java -cp jarfilelocation -Dproperty.file.location = classlocation

Right click on the project and export it as jar file. 右键单击该项目,然后将其导出为jar文件。

Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM