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 20, 2018 in Selenium by Jino
• 5,550 points
55 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 20, 2018 by Nabarupa

Related Questions In Selenium

0 votes
1 answer

How can I delete an element in Selenium using Python?

Hi friend, getElementByClassName is not a method on ...READ MORE

answered Mar 26 in Selenium by Surya
• 950 points

edited Mar 27 by Omkar 346 views
0 votes
1 answer
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,050 points
259 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
628 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
256 views
+1 vote
1 answer
0 votes
1 answer