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,950 points
1,922 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

How to click the search button using Selenium web driver and Python

You can try with tag. #this code will ...READ MORE

answered Apr 10, 2019 in Selenium by Matin
10,585 views
+1 vote
2 answers
0 votes
2 answers

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,520 points
4,052 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31 in Selenium by Sri
• 2,970 points
5,011 views
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,890 points
2,946 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2 in Selenium by Sri
• 2,970 points
3,379 views
0 votes
1 answer

How to check the state of a radio button or checkbox in Selenium?

Hey Priya, to check the state of ...READ MORE

answered May 7, 2019 in Selenium by Pratibha
• 3,690 points
726 views
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
523 views