mikesalvia
4/25/2017 - 8:20 PM

Test for move to actions in while using Selenium Grid and remote drivers

Test for move to actions in while using Selenium Grid and remote drivers

import org.junit.After
import org.junit.Before
import org.junit.Test
import org.openqa.selenium.By
import org.openqa.selenium.WebElement
import org.openqa.selenium.interactions.Actions
import org.openqa.selenium.remote.DesiredCapabilities
import org.openqa.selenium.remote.RemoteWebDriver

class FirefoxScrapTest {
	RemoteWebDriver driver

	@Before
	void setUp() {
		DesiredCapabilities capabilities = DesiredCapabilities.firefox()
    driver = new RemoteWebDriver(new URL("http://{grid running 3.4.0}/wd/hub"), capabilities)
	}

	@Test
	void testMoveTo() {
		driver.get("http://www.google.com")
		Actions action = new Actions(driver);
		WebElement element = driver.findElement(By.name("q"))
		action.moveToElement(element).click().build().perform()
	}

	@After
	void teardown() {
		driver?.quit()
	}
}