interact {
doubleClick(centerClickable)
}
def driver = browser.getDriver()
Actions action = new Actions(driver)
WebElement element= driver.findElement(By.className("vis-drag-center"))
def doubleclick = action.doubleClick(element).build()
doubleclick.perform()
import io.github.bonigarcia.wdm.WebDriverManager
import org.openqa.selenium.Dimension
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.firefox.FirefoxOptions
def chromeWebDriverVersion = '70.0.3538.67'
def driverFirefox = {
WebDriverManager.firefoxdriver().setup()
def driver = new FirefoxDriver()
driver.manage().window().setSize(new Dimension(width, height))
return driver
}
// ChromeDriver reference: https://sites.google.com/a/chromium.org/chromedriver/
// Download and configure ChromeDriver using https://github.com/bonigarcia/webdrivermanager
def driverChrome = {
WebDriverManager.chromedriver().version(chromeWebDriverVersion).setup()
def driver = new ChromeDriver()
driver.manage().window().setSize(new Dimension(width, height))
return driver
}
environments {
firefox {
driver = driverFirefox
}
chrome {
driver = driverChrome
}
//driver = driverFirefox
driver = driverChrome
Hi Martin.
Martin de laat schrieb am 03.01.2019 17:37:
--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/52750bc7-c083-466f-9b2a-f6a58b57cfdf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
package //todo add package
import geb.spock.GebReportingSpec
class visExampleTest extends GebReportingSpec {
def "dragging vis-js module"() {
given:
go "http://visjs.org/examples/timeline/interaction/animateWindow.html"
waitFor{ $(".vis-item-content").first().displayed }
def visModule = $(".vis-item-content").first()
def xCoordinate = visModule.getX()
when:
// I select and then drag the module 100 pixels right
visModule.click()
waitFor{ $(".vis-drag-center").displayed }
def draggable = $(".vis-drag-center")
interact{
clickAndHold(draggable)
moveByOffset(100, 0)
//Uncomment next line to get it to work with chrome
//moveByOffset(100, 0)
release()
}
then:
// the first visModule should've moved
xCoordinate != visModule.getX()
}
def "double clicking test"() {
given:
go "https://unixpapa.com/js/testmouse-2.html"
waitFor{ $("#link").displayed }
def clickable = $("#link")
when:
interact{
doubleClick(clickable)
}
println("browser ID: " + $("body > tt").text())
println("action log: " + $("body > table > tbody > tr > td:nth-child(1)
> form > textarea").value())
sleep(10000)
then:
true
}
}
Hi Martin.
The MCVE is helpful. But Chromedriver is by no means the only driver having issues here. The same test also fails on PhantomJS, Edge, Opera on my Windows machine. For Edge and Opera your workaround also fixes the issue, but not for PhantomJS. Maybe drag'n'drop is not supported there at all, I have not checked the documentation, just gave it a little spin. Basically I just used your test, but created a page object instead of using your hard-coded selectors. The issue is still clearly reproduceable. I also think the Chromium issue you linked in your message is what causes the problem.
// def visModule = $(".vis-item-content").first()
// def visModule = driver.findElement(By.id("link"))
def clickable = $("#link")
when:
interact{
doubleClick(clickable)
}
println("browser ID: " + $("body > tt").text())
println("action log: " + $("body > table > tbody > tr > td:nth-child(1) > form > textarea").value())
sleep(10000)
then:
true
}
}
So, for me, on mac, the output for the double click test was:chrome:
browser ID: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
action log: mousedown which=1 button=0 buttons=1
mouseup which=1 button=0 buttons=0
click which=1 button=0 buttons=0
dblclick which=1 button=0 buttons=0
(the stated browser ID (recognized by the test website) confuses me. But it's equal to the browser ID when I navigate to the website via my Mac with chrome installed)firefoxdriver:
browser ID: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:64.0) Gecko/20100101 Firefox/64.0
action log: mousedown which=1 button=0 buttons=1
mouseup which=1 button=0 buttons=0
click which=1 button=0 buttons=0
mousedown which=1 button=0 buttons=1
mouseup which=1 button=0 buttons=0
click which=1 button=0 buttons=0
dblclick which=1 button=0 buttons=0
I'm a junior developer and new to the OS community. I'm kinda unsure where the exact fault lies and what would be the best place to share this
--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/3acebc61-5d90-48ac-a834-f59af1ba35a0%40googlegroups.com.