Open GoogleCodeExporter opened 9 years ago
Original comment by mmcnu...@chromium.org
on 21 Aug 2014 at 9:34
Original comment by samu...@chromium.org
on 21 Feb 2015 at 12:18
Issue is reproducible with chromedriver:2.15
Sample Html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>WebDriver drag test</title>
<style>
#target {
height: 500px;
width: 500px;
background: orange;
}
#eves {
position: fixed;
left: 600px;
top: 50px;
}
</style>
</head>
<body>
<div id="target"></div>
</br>
<div id="eves"></div>
<script>
var eventLog = [];
function addToLog(ev) {
eventLog.push(ev.type + ' ' + (ev.buttons || ev.which));
document.getElementById("eves").innerHTML += eventLog.length + ' '
+ ev.type + ' ' + (ev.buttons || ev.which) + '</br>';
}
document.addEventListener('mousedown', function(ev) {
document.addEventListener('mousemove', addToLog);
addToLog(ev);
});
document.addEventListener('mouseup', function(ev) {
document.removeEventListener('mousemove', addToLog);
addToLog(ev);
});
</script>
</body>
</html>
Sample Code:
public static void main(String[] args) {
chrome();
firefox();
}
private static void chrome() {
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable(LogType.BROWSER, Level.ALL);
logPrefs.enable(LogType.CLIENT, Level.ALL);
logPrefs.enable(LogType.SERVER, Level.ALL);
logPrefs.enable(LogType.PERFORMANCE, Level.ALL);
logPrefs.enable(LogType.DRIVER, Level.ALL);
DesiredCapabilities caps = DesiredCapabilities.chrome();
caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
WebDriver driver=null;
try {
driver = new RemoteWebDriver(new URL("http://localhost:9515"),caps);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
doActions(driver);
}
private static void firefox() {
WebDriver driver = new FirefoxDriver();
doActions(driver);
}
private static void doActions(WebDriver driver) {
driver.get("file://" + Utility.getPath("Html/Bug_889.html"));
WebElement element = driver.findElement(By.id("target"));
Actions actions = new Actions(driver);
actions.moveToElement(element).clickAndHold(element).moveToElement(null, 100, 0).pause(200);
actions.moveToElement(null, 200, 0).pause(200).release().pause(200);
actions.build().perform();
System.out.println(((JavascriptExecutor) driver).executeScript("return window.eventLog;"));
}
Original comment by ssudunag...@chromium.org
on 20 Apr 2015 at 6:11
Issue 860 has been merged into this issue.
Original comment by ssudunag...@chromium.org
on 20 Apr 2015 at 8:11
Original comment by gmanikp...@chromium.org
on 26 May 2015 at 11:35
Original issue reported on code.google.com by
dfre...@chromium.org
on 21 Aug 2014 at 9:27Attachments: