Как решить org.openqa.selenium.WebDriverException: метод еще не был реализован - PullRequest
0 голосов
/ 21 мая 2018

Я использовал этот код в Selenium Androiddriver

WebDriverWait waiter = new WebDriverWait(driver, 30); 
Alert alert = waiter.until(ExpectedConditions.alertIsPresent());

, но я получаю сообщение об ошибке ниже.

org.openqa.selenium.WebDriverException: Method has not yet been implemented

Какой метод доступен для этого?

1 Ответ

0 голосов
/ 21 мая 2018

Это сообщение об ошибке ...

org.openqa.selenium.WebDriverException: Method has not yet been implemented

... означает, что WebDriverException возникло при попытке назначить тип возврата из ExpectedConditions методаalertIsPresent() к экземпляру Alert .

Ожидаемые условия метод alertIsPresent() при использовании в сочетании с WebDriverWait ожидает появления предупреждения и переключается на Alert при наличии Alert , и вы можете напрямую вызывать либо accept() или dismiss() следующим образом:

  • accept():

    new WebDriverWait(driver, 10).until(ExpectedConditions.alertIsPresent()).accept();
    
  • dismiss():

    new WebDriverWait(driver, 10).until(ExpectedConditions.alertIsPresent()).dismiss();
    

Примечание : необходимо добавить следующий импорт:

  • import org.openqa.selenium.support.ui.WebDriverWait;
  • import org.openqa.selenium.support.ui.ExpectedConditions;
  • import org.openqa.selenium.Alert;
...