-1

Im trying to select a radio button on a simple form, following is the link to the webpage that I have used https://getbootstrap.com/docs/4.1/examples/checkout/

I managed to capture the radio buttons and print the ID's of the radio buttons to the console. enter image description here enter image description here

Following is the the error occurs when I try to select the radio button

enter image description here

Exception in thread "main" org.openqa.selenium.ElementClickInterceptedException: Element is not clickable at point (205.5,740.5) because another element obscures it

Nimesh
  • 239
  • 2
  • 4
  • 14
  • It is better to paste code than add screenshots, especially if the screenshots don't show the complete error message. – Mate Mrše Sep 27 '18 at 06:45

2 Answers2

0
System.setProperty("webdriver.chrome.driver", "chromedriver");              
driver = new ChromeDriver();

driver.get("https://getbootstrap.com/docs/4.1/examples/checkout/");
Thread.sleep(2000);

// Radio 2 select
   driver.findElement(By.xpath("html/body/div[1]/div[2]/div[2]/form/div[9]/div[2]/label")).click();
   Thread.sleep(2000);

// Radio 3 select
   driver.findElement(By.xpath("html/body/div[1]/div[2]/div[2]/form/div[9]/div[3]/label")).click();
   Thread.sleep(2000);

// Submit button clicked.
   driver.findElement(By.xpath("html/body/div[1]/div[2]/div[2]/form/button")).click();
   Thread.sleep(2000);

   driver.close();

In this example I clicked on the second radio button and then clicked on the third radio button and then finally click on Submit button.

This is working fine.

Hiten
  • 724
  • 1
  • 8
  • 23
0

The exception which you are getting, below solution may resolve it:

Actions action = new Actions(driver);
action.moveToElement(paymentOptionRadio).click().perform();

Try click event by action class, it may work as expected.

Ishita Shah
  • 3,955
  • 2
  • 27
  • 51