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,940 points
928 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
4,958 views
0 votes
1 answer
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,510 points
9,731 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,510 points
1,539 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,850 points
1,485 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,850 points
1,264 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
126 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
158 views