In what class should I write:
Actions actions = new Actions(driver);
?
I don't want actions to be hard-coded. This is how my PageObjects looks like, here I want to use Actions Class
package Selenium;
import java.rmi.activation.ActivationSystem;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.RemoteWebDriver;
public class internetPO extends basicPageObject {
GenericWebElement wd;
public internetPO(GenericWebElement remotewebdriver){
this.wd=remotewebdriver;
}
public void hover(){
Actions actions = new Actions(driver);
WebElement ss= wd.element(byTypes.XPATH, finalElements.profileHover);
actions.moveToElement(ss).perform();
WebElement ww = wd.element(byTypes.XPATH, finalElements.profilename);
String valid = ww.getText();
System.out.println(valid);
}
And this is my TestClass:
package Selenium;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.RemoteWebDriver;
public class baseTest {
GenericWebElement wd;
public WebDriver webdriver;
public internetPO inter;
@Rule
public TestName name = new TestName();
public TestWatcher log = new TestWatcher() {
};
public void Testname(Description testname){
System.out.println("Starting test" + testname.getMethodName());
}
@Before
public void setup() throws Exception{
String Testname = name.getMethodName();
System.out.println("Strting test " + Testname);
wd=new ChromeWebDriver();
wd.init("http://localhost:4444/wd/hub");
inter = new internetPO(wd);
}
Need to mention I'm using RemoteWebDriver in GenericWebElement class. I tried a lot of options but no luck.