0
코드가 로컬로 작동하지만 RemoteWebDriver를 Sauce Labs 계정과 함께 사용할 경우 작업이 무시되는 것 같습니다.moveToElement가 Sauce Labs와 더 이상 작동하지 않습니다.
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;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
public class NavToURL {
public static final String USERNAME = "uname";
public static final String ACCESS_KEY = "uuid";
public static final String URL = "https://" + USERNAME + ":" + ACCESS_KEY + "@ondemand.saucelabs.com:443/wd/hub";
public static void main(String[] args) throws Exception {
DesiredCapabilities caps = DesiredCapabilities.chrome();
caps.setCapability("platform", "Windows 7");
caps.setCapability("version", "51.0");
caps.setCapability("screenResolution", "1280x768");
WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
driver.get("http://www.webpage.com");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
driver.findElement(By.id("menu-item-177")).click();
Thread.sleep(10000);
WebElement emailBox = driver.findElement(By.id("email"));
Actions actions = new Actions(driver);
actions.moveToElement(emailBox);
emailBox.sendKeys("[email protected]");
driver.findElement(By.className("submit-button")).click();
driver.quit();
}
}
SauceLabs 쪽 VM의로드 시간을 줄이기 위해 절전 타이머를 추가하기까지했습니다. 어떤 제안?
완벽하게 감사했습니다. –
도움이되는 (또는 어떤) 대답을 찾으면 그것을 upvote하십시오. 이 질문에 대한 답변이 있으면 대답으로 표시하십시오. 감사! – JeffC