How to click the gender radio button in facebook using Selenium?

+1 vote
I am unable to click on a button i.e. either male or female in facebook can someone please help?
Dec 18, 2018 in Selenium by Anjali
• 2,930 points
517 views

1 answer to this question.

0 votes

I used xpath for loacting the male and female radio buttons and it worked fine for me.

Here you can use the following code:

System.setProperty("webdriver.chrome.driver","C:\\yourpath\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.facebook.com");
driver.findElement(By.xpath("//*[contains(text(),'Female')]")).click();//for female 
driver.findElement(By.xpath("//*[contains(text(),'Male')]")).click();//for male

answered Dec 19, 2018 by Nabarupa

Related Questions In Selenium

0 votes
3 answers
0 votes
1 answer

How to scroll the Page up or down in Selenium WebDriver? (using java)

Its pretty simple. Check out the below ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,090 points
7,219 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,090 points
592 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
901 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
579 views
0 votes
1 answer
0 votes
1 answer

How can I click on male tag in facebook using selenium?

There is an approach for locating an ...READ MORE

answered Dec 20, 2018 in Selenium by Nabarupa
78 views