Checkbox unable to locate

53 views
Skip to first unread message

hiệp nguyễn văn

unread,
Nov 13, 2023, 9:43:31 AM11/13/23
to Selenium Users
Hello team,
I stuck with the find_element method. I want to create a tool to auto-submit my application, everything is fine until  I go through the checkbox "agree to the terms and conditions",I can see that the ID of this checkbox is not changing but when I run my code it shows that the location of this element is not found, but sometimes it ticks the checkbox successfully. 
UI.png
Initially, I thought it was related to the page loading and I was sleeping(50) but it seems this is not the root cause. It seems that the code also does not contain any iframes.

I'm attaching the HTML_content content here so everyone can take a look at it
my code to click on the checkbox is :
terms = browser.find_element(By.XPATH, value="//input[@id='_2a0ba0a0a0e0a0a0a5a1a_input']")
terms.click()

Does anyone have any idea how to make it work? 
HTML_content.txt

Nortier David

unread,
Nov 14, 2023, 3:14:06 AM11/14/23
to seleniu...@googlegroups.com

Hello

 

  • Perhaps the location is too near the border
  • Or Try find by id
  • Or Wait the element is clickable
  • Or click on the label of the checkbox

 

PS: what about the exact error ?

 

David

 

De : seleniu...@googlegroups.com <seleniu...@googlegroups.com> De la part de hi?p nguy?n van
Envoyé : dimanche 12 novembre 2023 18:01
À : Selenium Users <seleniu...@googlegroups.com>
Objet : [selenium-users] Checkbox unable to locate

 

ATTENTION : cet e-mail provient d'une personne externe. Vérifiez toujours l’expéditeur avant d’ouvrir les pièces jointes ou de cliquer sur les liens.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/883dd76a-1345-4b75-9bdd-da8f6c0b8f95n%40googlegroups.com.


====== DISCLAIMER ======

https://www.cph.be/maildisclaimer

Julio Lemus

unread,
Nov 14, 2023, 5:51:13 AM11/14/23
to seleniu...@googlegroups.com
Maybe it into a Frame 

Saludos cordiales

Julio Isaías Lemus López
Ingeniero en Ciencias y Sistemas
Teléfono: (502) 5602 5000

Antes de imprimir este correo electrónico, piense bien si es necesario hacerlo: El medio ambiente es cuestión de todos.


--

sriram srinivasan

unread,
Nov 14, 2023, 11:07:57 AM11/14/23
to seleniu...@googlegroups.com

You can try other ways to perform the click operations like using :


1. Actions..


Actions act = new Actions(driver);

act.moveToElement(driver.findElement(By.id("_2a0ba0a0a0e0a0a0a5a1b"))).click().perform();


2. Using JavascriptExecutor

JavascriptExecutor js = (JavascriptExecutor) driver;

WebElement elementToClick = driver.findElement(By.id("_2a0ba0a0a0e0a0a0a5a1b"));

js.executeScript("arguments[0].click();", elementToClick);


Do let know if this resolved your problem

Thanks,

Sriram


Reply all
Reply to author
Forward
0 new messages