-1

enter image description here

    WebDriverWait wait = new WebDriverWait(driver, 30); 
    WebElement button = wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath("(//div[contains(@class,'RadioButton_radioButton__12O81')]//label[contains(@for,'2')])"))));
    button.click();

Radio button selection...

  • 1
    Could you share the HTML and stacktrace? – João Farias Aug 21 '19 at 7:25
  • 1
    check updated info... – jjjj Aug 21 '19 at 7:31
1

The problem is probably on this Thread.sleep. You could add an explicit wait for the element before clicking.

WebDriverWait wait = new WebDriverWait(driver, timeout); 
WebElement button = wait.until(ExpectedConditions.elementToBeClickable(locator));
button.click();

It will check constantly the state of the element and continue to the click as soon as it is clickable (for timeout seconds maximum).

| improve this answer | |
  • Tried dear no luck...Expected condition failed: waiting for element to be clickable: [[ChromeDriver: chrome on XP (83f26d23ff23e73792538048339074f5)] -> xpath: (//div[contai – jjjj Aug 21 '19 at 11:30
  • 1
    Probably your locator is wrong, to select the radio button, you must click on the input tag, not on the label - a label is never clickable. – João Farias Aug 21 '19 at 13:00
0

The problem is, your radio button is clickable at some other point. So you need to clearly identify the clickable element in your DOM.
Try this may it help-

    WebDriverWait wait = new WebDriverWait(driver, 30); 
    WebElement button = wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath(".//div[@class='RadioButton_radioButton__12O81']/input"))));
    button.click();
| improve this answer | |
  • no luck.. thank you for your help dear. – jjjj Aug 21 '19 at 12:28
0

Looks like this Radio button falls under the category of Pseudo Element (::before, ::after things)

Can you try clicking using Action Classes here: Actions action = new Actions(); action.moveToElement(locator).moveByOffset(100, 0).click(),build().perform();

Let me know on this!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.