0

I am a newbie in AWS device farm. I am trying to execute automation test on Desktop browser testing project. I have done aws configure to create credentials and write code as below but got error. Could anyone know how to fix this issue?

String myProjectARN = "<project-ARN>";
DeviceFarmClient client  = DeviceFarmClient.builder().region(Region.US_WEST_2).build();
CreateTestGridUrlRequest request = CreateTestGridUrlRequest.builder()
        .expiresInSeconds(600)
        .projectArn(myProjectARN)
        .build();
URL testGridUrl = null;
try {
    CreateTestGridUrlResponse response = client.createTestGridUrl(request);
    testGridUrl = new URL(response.url());
} catch (Exception e) {
    e.printStackTrace();
}
//Assertions.assertNotNull(testGridUrl);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("browserName","chrome");
capabilities.setCapability("browserVersion", "latest");
capabilities.setCapability("platform", "windows");

driver = new RemoteWebDriver(testGridUrl, capabilities);
driver.navigate().to("https://www.google.com.sg");
System.out.println(driver.getTitle());

Error

org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement: {error=invalid session id, message=The session null does not exist}
Build info: version: '2.53.1', revision: 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
System info: host: '', ip: '', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_171'
Driver info: driver.version: RemoteWebDriver

    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:370)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:500)
    at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355)
    at edu.TestAWS.test(TestAWS.java:60)

I also have checked capabilities error "Create Session request doesn't have capabilities defined" enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.