-1

(Sign In) this is the html tag of yahoo sign in. I want to click on the sign in using selenium web driver, and also get the value which is in the title="sign in"? can anyone solve my problem please.

Arya
  • 85
  • 3
  • 12
  • using the following code i got the result WebElement el = driver2.findElement(By.xpath("//*[@id='yucs-profile']/a/b")); String elementValue = el.getText(); //This one gets the value el.click(); – Arya May 29 '15 at 04:14

2 Answers2

0
 WebElement el = driver.findElement(By.cssSelector(".social-enabled-txt"));
    String elementValue =  el.getText(); //This one gets the value 
      el.click(); // This one clicks on the signin button on yahoo.com homepage. 
Madis Kangro
  • 293
  • 3
  • 12
  • Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//*[@id='yui_3_12_0_1_1432726437479_842']"} Command duration or timeout: 702 milliseconds – Arya May 27 '15 at 13:59
  • Thanks for the reply, I wrote as per your guidence but I got this error in the console – Arya May 27 '15 at 14:00
  • Ok let me ask you a couple of things. Where is that button you are trying to find urself. Where are you having problems? 1. Open Yahoo.com 2. Click on Sign In button 3.what next? The solution i provided only works when i open www.yahoo.com and click that sign in button. – Madis Kangro May 27 '15 at 14:16
  • when you open yahoo.com it is near upper right corner.1) I want to click that and 2)login into the yahoo home. I am having problem in clicking sign in link – Arya May 27 '15 at 15:22
0

If you want to click on the yahoo sign-in link using the selenium web driver and want to get the value in the title = "sign", the Below code has been given.

driver.get("https://in.search.yahoo.com/?fr2=inr");
        
//get the text of title in sign in 
String text = driver.findElement(By.className("text")).getText(); 

// Print the title of value
System.out.println("Title of sign in button is : "+text);    
        
//click on sign in link using xpath
driver.findElement(By.xpath("//*[@id=\"ysignin\"]/div")).click();  
lemon
  • 14,875
  • 6
  • 18
  • 38