package newproject;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Amazon {
public static void main(String[] args) throws InterruptedException {
String url = ("https://in.yahoo.com/");
System.setProperty("webdriver.chrome.driver",
"F:\\Driver\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get(url);
driver.manage().deleteCookieNamed(url);
driver.navigate().forward();
driver.manage().window().maximize();
driver.findElement(By.id("uh-signin")).click();
driver.findElement(By.id(“ login-username”))。sendKeys(“ [email protected]”);
Thread.sleep(2000);
driver.navigate().forward();
driver.findElement(By.id("login-signin")).click();
//driver.findElement(By.name("password")).click();
driver.findElement(By.id("login-passwd")).sendKeys("Pranavpooja@2017");
//System.out.print("You are welcome");
}
}
我正在尝试在yahoo登录页面中输入用户名和密码,但我能够输入用户名,但无法输入密码
请找到以下解决方案。
解决方案>>
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
//driver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS);
driver.get("https://in.yahoo.com/");
driver.findElement(By.xpath("//button[@name='agree']")).click();
driver.findElement(By.xpath("//a[@id='uh-signin']")).click();
driver.findElement(By.id("login-username")).sendKeys("[email protected]");
driver.findElement(By.id("login-signin")).click();
Thread.sleep(5000);
driver.findElement(By.xpath("//input[@id='login-passwd']")).sendKeys("Pranavpooja@2017");
要登录雅虎,您可以使用以下解决方案: