저는 Selenium WebDriver를 사용하여 우리 사이트에 로그인하기 위해 이메일 주소 필드를 캡처하려고합니다.Selenium id = 이메일을 찾을 수 없습니다.
그래서 이메일을 삽입 할 수있는 전자 메일 주소 필드를 감지하는 내 코드는 다음과 같습니다
이WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.presenceOfElementLocated(By.id(("email"))));
WebElement email = driver.findElement(By.id("email"));
email.sendKeys(email);
웹 페이지의 HTML은 이것이다 :
<input type="text" title="Email Address" class="input-text required-entry validate-email"
id="email" value="" name="login[username]">
문제는, 셀레늄보고 그것은 id = email을 찾을 수 없다 ???
브라우저는 IE입니다. FF 및 Chrome에서 정상적으로 작동합니다.
이 이름이나 ID를 사용하기 때문에 항상 더 추가되는 경우는 XPath는 변경 될 수 있습니다 중 하나
교체 worked : By.xpath (".// input [@ title = '이메일 주소']") – RalphF