How can I click on male tag in facebook using selenium

0 votes
I am unable to click on male radio button on facebook. Apparently both male and female RB has the same class name.

Please someone help me in this. I am stuck here actually.
Dec 21, 2018 in Selenium by Jino
• 5,820 points
1,943 views

1 answer to this question.

0 votes

There is an approach for locating an element using selenium.

First look for the ID then CSS Selector and then the XPath and then the Class Name.

Here is what I got from facebook both female and male have different ID and that is what you should be looking for.

<input type="radio" name="sex" value="1" id="u_0_9">

<input type="radio" name="sex" value="2" id="u_0_a">

Now that you know as how to approach the problem. I would suggest that you do the remaining thing rather than getting the complete answer.

Here is what I did

driver.findElement(By.xpath("//*[contains(text(),'Female')]")).click();
driver.findElement(By.xpath("//*[contains(text(),'Male')]")).click();

answered Dec 21, 2018 by Nabarupa

Related Questions In Selenium

+1 vote
2 answers
+1 vote
2 answers

How can I delete an element in Selenium using Python?

You can directly delete the node using ...READ MORE

answered Sep 14, 2019 in Selenium by tonystark
• 500 points
19,839 views
0 votes
1 answer

How can I scroll a web page in Mozilla Firefox using Selenium?

Hi Rohan, steps to scroll a webpage in ...READ MORE

answered May 14, 2019 in Selenium by Pratibha
• 3,690 points
3,203 views
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,500 points
13,686 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

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

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,149 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,910 points
7,228 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 3, 2020 in Selenium by Sri
• 3,190 points
7,880 views
+1 vote
1 answer
0 votes
1 answer

How can I travel forward and back in a browser using selenium?

You can use the Navigate interface to ...READ MORE

answered Dec 31, 2018 in Selenium by Nabarupa
12,251 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP