Reputation: 21
I am stuck with a game application where the appium returns 200 status code for a spin click(none of the clicks on game page is working though appium returns 200 code) but the click is not performed on the device. It is a web application and I am using the real device. Any help would be greatly appreciated.
I have tried using implicit, explicit waits, wait using Thread, Javascript, coordinates based click but no luck.
I am using the below code:
public class AndriodDriver {
AndroidDriver<WebElement> driver;
@Test
public void testFirstCalculator() throws IOException, InterruptedException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "Samsung Galaxy S7");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
capabilities.setCapability("platformVersion", "7.0");
driver = new AndroidDriver<WebElement>(new
URL("http://0.0.0.0:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get("https://pa03-mob.wi-gameserver.com/resource-service/test-
lobby/index.html");
driver.manage().timeouts().implicitlyWait(200, TimeUnit.SECONDS);
System.out.println("main url");
driver.findElement(By.xpath(".//*[@id='Open Lobby with debug properties']")).click();
System.out.println("lobby opened");
driver.findElement(By.xpath(".//*[@id='brucelee']")).click();
System.out.println("game loading");
WebDriverWait wait= new WebDriverWait(driver, 30);
//wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//*
[@id='spin-button']")));
Thread.sleep(3500);
driver.findElementByXPath(".//*[@id='spin-button']").click();
}
}
Upvotes: 0
Views: 489
Reputation: 1
First step: Please add the following capability :
cap.setCapability("automationName","MyTest");
Second step:
Please replace the line :
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
by this:
cap.setCapability("browserName","Chrome");
Upvotes: 0