Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

325
Visualizações
How do I get a popup validation message from a page using selenium Python?

How do I get the popup validation message "Please tick this box if you want to continue" using Selenium Python in the photo?

<input oninvalid="this.setCustomValidity('Please tick this box if you want to proceed')" oninput="this.setCustomValidity('')" class="form-check-input checkbox-switch-md" type="checkbox" id="registerTermsCheckboxId" required="">
enter image description here

Screenshot

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Try the below, I hope this will solve your issue.

from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait


toolTip = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, 'registerTermsCheckboxId')))
hov = ActionChains(driver).move_to_element(toolTip)
txt = hov.perform()
tooltipText = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, 'registerTermsCheckboxId'))).text
print(tooltipText)
about 4 years ago · Juan Pablo Isaza Relatório

0

Found a solution to the problem, where I was able to extract the text in the validation message with the following JavaScriptExecutor code:

message_element = driver.find_element(By.XPATH, Locators.acceptCheckButton_xpath)
accept_button_message = driver.execute_script("return arguments[0].validationMessage", message_element)
print("Message : ", accept_button_message)
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda