How can I retrieve the radio button value ?
In Facebook.com there is a radio button SEX with both Male and Female options.
When I use the GetText() how can I get the label value “Female” and “Male”?
I have written code for selecting the Female/Male options by using send key but at the same time I am trying to retrieve the selected radio button whether FEMALE/MALE using the below code. But even though I select MALE when I retrieve the radio button text it displays as FEMALE. How can I get the radio button label for the selected radio button option? please find attached screenshot
//selecting "FEMALE" option driver.findElement(By.xpath(".//*[@id='u_0_d']")).click(); //retrieving the selected radio button option driver.findElement(By.xpath("//input[@name='sex']/../label")).getText()