我正在尝试编写用于登录的脚本..发送密钥正在运行 但按钮没有被点击。
以下是HTML代码:
<div style="text-align: right">
<button id="btnLogin" class="btn btn-wide btn-success col-xs-offset-6"style="width: 85px; font-weight: bold; margin-left: 0px" type="submit"> Sign In</button>
</div>
这是JAVA代码:
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.By.ByTagName;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Main {
public static void main(String[] args)
{
WebDriver driver=new FirefoxDriver();
driver.get("here is my url");
driver.findElement(By.id("UserName")).sendKeys("dishashah");
driver.findElement(By.id("Password")).sendKeys("disha1234");
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.id("btnLogin")).click();
}
}