[英]Selenium GRID Test execution
I am trying hard to run my Selenium Test not local but in a grid. 我正在努力在本地而不是本地运行Selenium Test。 I thought I am doing good but I don´t get it to run.
我以为我做的很好,但我没有让它运行。 HUB and NODE are Up and running(started with CMD) and I am using the right IP adresses.
HUB和NODE已启动并正在运行(从CMD开始),我使用的是正确的IP地址。 Please let me know what I am doing wrong!
请让我知道我做错了! Do you think it maybe could be a problem with a proxy?
您是否认为代理可能有问题?
Greetings Arno (student from Germany) 问候亚诺(来自德国的学生)
// Import all the stuff I need
public class MpreisScreenshot_ID {
private String baseUrl;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
String requiredBrowser = "firefox";
}
//the "if" underneath is just for a selection (to make it better to read
// I deleted the others)
if (requiredBrowser == "firefox")
{
DesiredCapabilities capabilityFirefox = DesiredCapabilities.firefox();
capabilityFirefox.setBrowserName("firefox");
capabilityFirefox.setVersion("54");
WebDriver driver= new RemoteWebDriver(new
URL("http://***.***.***.**:4445/grid/register"),capabilityFirefox);
}
baseUrl = "http://*****/****";
// driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}
WebDriver driver;
@Test
public void captureScreenshot() throws Exception
{
//Start of Selenium test
// Maximize the browser
driver.manage().window().maximize();
// deleted all the steps
@AfterMethod
public void tearDown(ITestResult result)
{
// Test failing or Passing?
if(ITestResult.FAILURE==result.getStatus())
{
try
{
// Create reference of TakesScreenshot
TakesScreenshot ts=(TakesScreenshot)driver;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
String uhrzeit= sdf.format(timestamp);
// Call method to capture screenshot
File source=ts.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(source, new File("D:\\DATA\\Selenium\\TestNG-
Screenshots\\"+result.getName()+uhrzeit+".png"));
System.out.println("Screenshot taken");
}
catch (Exception e)
{
System.out.println("Exception while taking screenshot "+e.getMessage());
}
}
// close application
driver.quit();
}
}
检查您的URL,通常Selenium Hub的默认端口为4444,也尝试以下操作:
http://youripaddress:4444/wd/hub/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.