from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support import expected_conditions as EC
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
service = Service(executable_path="chromedriver.exe")
driver = webdriver.Chrome(service=service)
chrome_options = Options()
chrome_options.add_argument('--ignore-certificate-errors')
def launch_page():
driver.get('https://webpage.com')
time.sleep(3)
realname = driver.find_element(By.ID, 'user-name')
realname.send_keys('test') #TYPE UR NAME
lastname = driver.find_element(By.ID, 'user-lastname')
lastname.send_keys('testt') #TYPE UR LASTNAME
Rusername = driver.find_element(By.ID, 'user-username')
Rusername.send_keys('tessst') #TYPE UR USERNAME
email = driver.find_element(By.ID, 'user-gmail')
email.send_keys('[email protected]') #TYPE UR EMAIL
telephone = driver.find_element(By.ID, 'user-telephone')
telephone.send_keys('02311') #TYPE UR TELEPHONE
termsofservice = driver.find_element(By.CLASS_NAME, 'checkbox-1')
termsofservice.click() #CLICKS THE CHECKBOX
button_start = driver.find_element(By.CLASS_NAME, 'btn-1')
button_start.click() #MOVES ON TO THE QUESTIONS
time.sleep(5)
def find_question():
time.sleep(1)
question = driver.find_element(By.CLASS_NAME, 'text-class-1')
print(question.text)
def main():
launch_page()
find_question()
if __name__ == '__main__':
main()
Im trying to get the quiz question so i can build a database of the questions, but selenium keeps skipping questions randomly. Is it possible that there is some kind of protection against that on the webpage im trying and if there is how can i check for it?? This only happens when the findquestion() function is working, and driver.findelement is included, without it the selenium does not skip questions!!! Any help with this would be greatly appreciated. Thanks!
New contributor
Bonn Bonn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.