Iam trying to find and click on this button. But i always face with "Message: Unable to locate element:"
I try this options, but its doesnt help me:
First: driver.find_element_by_xpath('//button[contains(text(), "CLAIM NOW!")]').click()
Second: driver.find_element_by_xpath('//button[@onclick="getClaim()"]').click()
Third: driver.find_element_by_css_selector('a.btn').click()
Fourth: driver.find_element_by_class_name('btn btn-lg btn-primary').click()
Firth: driver.find_element_by_id('roll_button_container').click()
Also iam using time.sleep()
so its not problem with time
Flow of actions: After I click on the "Claim Now!" a new tab will open, but in the previous one (which I am on now) - I will get points. And I need to automate this on the project
My almost full code ( cant show you everything as company policy):
from selenium import webdriver
import time
driver = webdriver.Firefox (executable_path = "/Users/USER1/Downloads/AUTOMATION/geckodriver")
driver.get("https://LINK.net/")
time.sleep(3)
driver.find_element_by_xpath('/html/body/header/nav/div/div/ul/li[5]/a').click()
time.sleep(3)
element = driver.find_element_by_xpath('/html/body/div[3]/div/div/form/div[1]/input').send_keys("login")
time.sleep(3)
el2 = driver.find_element_by_xpath('/html/body/div[3]/div/div/form/div[2]/input').send_keys("password")
time.sleep(3)
driver.find_element_by_css_selector('#loginForm > div:nth-child(3) > button:nth-child(1)').click()
time.sleep(3)
driver.find_element_by_xpath('//*[@id="test_button"]').click()
time.sleep(3)
#driver.find_element_by_xpath('//button[contains(text(), "CLAIM NOW!")]').click()
#driver.find_element_by_xpath('//button[@onclick="getClaim()"]').click()
#driver.find_element_by_class_name('btn btn-lg btn-primary').click()
#driver.find_element_by_id('roll_button_container').click()
driver.find_element_by_css_selector('a.btn').click()
time.sleep(3)
driver.quit()
while True:
time.sleep(60 * 5)
Does anyone can help me to click on button correctly? Thanks a lot.