과거의 복사 및 간단한 텍스트 지나서 원하는 출력을 제공하지 아래 성공적으로 텍스트 값을 선택할 수 있으며, 문제가있는 경우 내 코드셀레늄 작업 클래스 I 복사하려고 텍스트
public class practiceExample2 {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "G:\\TopsAssignment\\SampleJavaExample\\lib\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.facebook.com/");
WebElement elm1 = driver.findElement(By.id("email"));
WebElement elm2 = driver.findElement(By.id("pass"));
Actions cpypast = new Actions(driver);
Action write = cpypast.sendKeys(elm1, "Pratik").build();
Action select = cpypast.doubleClick(elm1).build();
Action copy = cpypast.sendKeys(elm1, Keys.CONTROL).sendKeys(elm1, "C").build();
Action past = cpypast.sendKeys(elm2,Keys.CONTROL).sendKeys(elm2,"V").build();
write.perform();
select.perform();
copy.perform();
past.perform();
String str = elm2.getText();
System.out.println(str);
driver.close();
}
}
가 왜'Actions' 클래스를 사용하려고이 잘 작동 로봇 클래스를 시도? – DebanjanB
답장을 보내 주셔서 감사합니다. Robot 클래스와 잘 작동합니다. – pratik22