How do you quit mobile application using java-client 8

io.appium java-client 7.6.0

AndroidDriver androiddriver
androiddriver.quit();//Worked

io.appium java-client 8.4.0

WebElement androiddriver
androiddriver.quit(); //FAILS - The method quit() is undefined for the type

Why cast androiddriver to WebElement? I’m a big fan of reading the unit tests when questions like this arise. Here is the base unit test that creates driver in @Before, and quits in @After:

Notice that like your 7.6.0, androiddriver is declared as type AndroidDriver, which has the .quit() method. I don’t think the type WebElement has .quit(), which is exactly the error you are getting.

1 Like

I’ve tried use

AndroidDriver androiddriver;
androiddriver.quit(); //Works

But I’m unable to do something like this.

AndroidDriver objFrame = androiddriver.findElement(By.xpath(""));

But I get this error

Multiple markers at this line

  • Type mismatch: cannot convert from WebElement to
    AndroidDriver

  • MobileElement cannot be resolved to a type

Nevermind I got it to work.

WebElement objFrame = androiddriver.findElement(By.xpath("."));

2 Likes

How to accept order autocratically from saned app