Перейти к содержимому

Фотография

Actions работает только c FirefoxDriver


  • Авторизуйтесь для ответа в теме
В теме одно сообщение

#1 Grishka

Grishka

    Новый участник

  • Members
  • Pip
  • 2 сообщений
  • ФИО:Григорий

Отправлено 16 февраля 2019 - 10:47

Имею следующий простенький код, который выполняется только с Gecko (Firefox) driver.

 

Тот же код с любым другим драйвером кидает exception:

 

Exception in thread "main" java.lang.AbstractMethodError: org.openqa.selenium.remote.RemoteWebElement.getCoordinates()Lorg/openqa/selenium/interactions/Coordinates;
at org.openqa.selenium.interactions.internal.MouseAction.getActionLocation(MouseAction.java:69)
at org.openqa.selenium.interactions.MoveMouseAction.perform(MoveMouseAction.java:42)
at org.openqa.selenium.interactions.CompositeAction.perform(CompositeAction.java:34)
at org.openqa.selenium.interactions.Actions$BuiltAction.perform(Actions.java:642)
at utils.CheckActions.main(CheckActions.java:36)
 
Код:
 
import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;


import java.util.concurrent.TimeUnit;

public class CheckActions {
public static void main(String[] args) {

// System.setProperty("webdriver.gecko.driver", "geckodriver.exe");
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");


// WebDriver driver = new FirefoxDriver();

WebDriver driver = new ChromeDriver();

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().window().maximize();

driver.get("http://google.com");

Actions action = new Actions(driver);

WebElement field = driver.findElement(By.xpath("//input[@name='q']"));

//action.sendKeys(field, "BLABLABLA").build().perform();
action.moveToElement(field).build().perform();

driver.close();
}
}

  • 0

#2 Grishka

Grishka

    Новый участник

  • Members
  • Pip
  • 2 сообщений
  • ФИО:Григорий

Отправлено 16 февраля 2019 - 11:15

Свежая версия chrome driver проблему решила. закрывайте.


  • 0


Количество пользователей, читающих эту тему: 0

0 пользователей, 0 гостей, 0 анонимных