我尝试了类名,具有类型和名称的xpath。还是没用。
<div class="login-btn">
<button type="submit" class="hvr-shutter-out-horizontal">Update</button>
</div>
答案 0 :(得分:0)
请尝试这个-
a) .//button[@type='submit'] or
b) .//*[@type='submit'][@class='hvr-shutter-out-horizontal']
还请提及您用作xpath的东西,但不起作用。
答案 1 :(得分:0)
driver.findElement(By.id("email")).sendKeys(uname1);
Thread.sleep(2000);
System.out.println("Username entered sucessfully");
Thread.sleep(2000);
driver.findElement(By.name("Password")).sendKeys(password1);
Thread.sleep(2000);
driver.findElement(By.className("hvr-shutter-out-horizontal")).click();
Thread.sleep(2000);
System.out.println("Password entered sucessfully");
System.out.println("logged in successfully");
Thread.sleep(6000);
//Edit Profile page
driver.findElement(By.linkText("PROFILE")).click();
System.out.println("Profile Update page loaded successfully");
Thread.sleep(6000);
driver.findElement(By.id("MiddleName")).sendKeys("KS");
Thread.sleep(2000);
System.out.println("Middle name entered");
Thread.sleep(2000);
driver.findElement(By.xpath("[@type='submit'][@class='hvr-shutter-out-horizontal']")).click();
Thread.sleep(2000);
我尝试了上述代码。仍然显示无法找到元素。也许登录按钮也具有相同的属性?
答案 2 :(得分:0)
driver.findElement(By.xpath("//div[@class='login-btn']")).click();
这个工作了。谢谢大家。