私はテストを自動化しようとしていますが、私はセレン3.4を使用しています。 テストコードに問題はありません 要素を見つけるために、そのできません。このテストを実行した後:}ロケータセレナが見つかりません3.4
public class TC001_LoginWithInvalidCredentials {
WebDriver driver ;
@BeforeTest
public void setUp(){
System.setProperty("webdriver.gecko.driver",System.getProperty("user.dir")+"/Drivers/geckodriver.exe");
driver = new FirefoxDriver();
driver.get("http://automationpractice.com/index.php?");
}
@Test
public void LoginWithInvalidCredentials(){
driver.findElement(By.xpath(".//*[@id='header']/div[2]/div/div/nav/div[1]/a")).click();
driver.findElement(By.id("email")).sendKeys("[email protected]");
driver.findElement(By.id("passwd")).sendKeys("passwrd");
driver.findElement(By.xpath(".//*[@id='SubmitLogin']")).click();
Assert.assertEquals(driver.findElement
(By.xpath(".//*[@id='center_column']/div[1]/ol/li")).getText(), "Authentication failed.");
}
@AfterTest
public void endTest(){
driver.close();
}
<div class="form_content clearfix">
<div class="form-group form-error">
<label for="email">Email address</label>
<input id="email" class="is_required validate account_input form-control" data-validate="isEmail" name="email" value="" type="text">
</div>
<div class="form-group">
<label for="passwd">Password</label>
<span>
<input id="passwd" class="is_required validate account_input form-control" data-validate="isPasswd" name="passwd" value="" type="password">
</span>
</div>
<p class="lost_password form-group">
<a href="http://automationpractice.com/index.php?controller=password" title="Recover your forgotten password" rel="nofollow">Forgot your password?</a>
</p>
<p class="submit">
<input class="hidden" name="back" value="my-account" type="hidden">
<button id="SubmitLogin" class="button btn btn-default button-medium" type="submit" name="SubmitLogin">
どのようなエラーがありますか、どの要素ですか? – kushal