2017-02-26 1 views
0

Selen WebDriver: Mouse cursor Schweben nicht funktioniert für Firefox Version 50Selen WebDriver: Mouse cursor Schweben nicht funktioniert

import org.openqa.selenium.By; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.WebElement; 
import org.openqa.selenium.firefox.FirefoxDriver; 
import org.openqa.selenium.interactions.Actions; 
public class Ajax_Mouse_Interactions { 
public static void main(String[] args) throws InterruptedException { 

Pfad für firefox Treiber

System.setProperty("webdriver.gecko.driver", 
"C://Users//user2//Downloads//geckodriver-v0.11.1-win64//geckodriver.exe"); 

WebDriver driver = new FirefoxDriver(); 

driver.get("http://www.amazon.in/");   

Thread.sleep(20000);       

Aktionen Klasse zur Mausbehandlung

Actions action = new Actions(driver); 

WebElement element=driver.findElement(By.linkText("nav-link-yourAccount")); 

action.moveToElement(element).build().perform(); 
} 
} 

Erste folgende Ausnahme

Upsupported Befehl Exception

Antwort

0

Ich versuche jetzt das. Dieser Code funktioniert für mich.

import java.awt.Robot; 
... 
Point point = webDriver.findElement(By.xpath("//a[@title='Emitir Guias']")).getLocation(); 
System.out.println(point.toString()); 
Robot robot = new Robot(); 
robot.mouseMove(point.x+10,point.y+110); //This 10 and 110 just to adjust coordenate in my case 

Thread.sleep(3000); //Pause for you see the mouse move 

Quelle https://stackoverflow.com/posts/12978079/revisions