click()
method is not working in selenium python. I have used all of the methods which are available in selenium documentation. I want to apply automation to this URL.
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from time import sleep
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
ser = Service("D:\chromedriver")
op = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=ser, options=op)
actionChains = ActionChains(driver)
driver.get('https://cultivatedculture.com/mailscoop/')
driver.maximize_window()
sleep(2)
# log = driver.find_element(By.LINK_TEXT, "LOG IN")
# sleep(2)
# log.click()
for i in range(3):
#-----------------------------------------------------
name = 'jay kakadiya'
domain = 'gmail.com'
inp = driver.find_element(By.ID ,'name')
inp.send_keys(name)
inp2 = driver.find_element(By.ID ,'domain')
inp2.send_keys(domain)
sleep(1)
btn = driver.find_element(By.XPATH, '//*[@id="find_btn"]')
sleep(1)
btn.click()
actionChains.move_to_element(btn).click().perform()
print("press click")
#-----------------------------------------------------------
# if i == 0:
#
# popup1 = driver.find_element(By.XPATH('//*[@id="jsSignupModalForm"]/div[2]/div/p[5]/span'))
# sleep(1)
# actionChains.move_to_element(popup1).click().perform()
# popup2 = driver.find_element(By.XPATH('//*[@id="jsLoginModalForm"]/div[2]/div/div[1]/div[3]'))
# sleep(1)
# actionChains.move_to_element(popup2).click().perform()
# driver.find_element_by_id('jsUserLoginModal').send_keys('pagiri2277@flowminer.com')
# driver.find_element_by_id('jsUserLoginModal').send_keys('jaykakadiya63522')
# sleep(1)
# popup3 = driver.find_element(By.XPATH, '//*[@id="jsLoginModalForm"]/div[2]/div/div[2]/div"]')
# actionChains.move_to_element(popup3).click().perform()
Once you fillup the Full Name
and Company Website
fields next to click on the element Find It you need to induce WebDriverWait for the element_to_be_clickable() and you can use the following locator strategies:
driver.get('https://cultivatedculture.com/mailscoop/')
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input#name[name='name']"))).send_keys("jay kakadiya")
driver.find_element(By.CSS_SELECTOR, "input#domain[name='domain']").send_keys("gmail.com")
driver.execute_script("arguments[0].click();", WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button#find_btn > span > span"))))
Note: You have to add the following imports :
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
Browser Snapshot: