-1

hello i am trying to login in website https://golden77.com but can not login it give following error

selenium.common.exceptions.ElementClickInterceptedException: Message: Element <button class="btn btn-primary ml-2"> is not clickable at point (1278,72) because another element <div id="login" class="modal fade show modal-login-new"> obscures it.

This is my code:- from seleniumwire import webdriver from selenium.webdriver.common.keys import Keys from time import sleep from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC

options=webdriver.FirefoxOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument('--ignore-ssl-errors')
options.add_argument('--ignore-certificate-errors')

driver = webdriver.Firefox(executable_path='geckodriver.exe',firefox_options=options)
driver.get("https://golden77.com")
# print(driver.requests)
sleep(10)
sleep(50)
btn_login = driver.find_element_by_xpath("//button[@class='btn btn-primary ml-2']") #<button class="btn btn-primary ml-2">Login</button>
btn_login.click()
sleep(10)
username = driver.find_element_by_xpath("//input[contains(@class,'form-control')][@placeholder='Enter Username']")
username.send_keys("username")
sleep(20)
password = driver.find_element_by_xpath("//input[contains(@class,'form-control')][@placeholder='Enter Password']")
password.send_keys("password")
sleep(3)
try:
    checkbox=driver.find_element_by_class_name("custom-control-label")
    checkbox.click() #check the checkbox
except:
    pass
sleep(10)


lg_btn = driver.find_element_by_xpath("//button[@class='btn btn-primary ml-2']") # login button 
prop = lg_btn.get_property("disabled")
print(prop)
lg_btn.click

i also tried

driver.execute_script("arguments[0].click()",lg_btn)

(This code not giving error and not logging me in) referer actual webpage code of https://golden77.com and help me!

cruisepandey
  • 6,860
  • 3
  • 9
  • 24
User 111
  • 1
  • 2

1 Answers1

0

two issue you have right now in your code.

  1. The class that you are using for check box has 3 web element. So it will click on first element.

  2. When you are actually clicking on login button in the alert pop up, you are not using the right login web element locator.

Fix issue 1 :

try:
    checkbox=driver.find_element_by_id("customCheck")
    checkbox.click() #check the checkbox
except:
    pass

Fix issue 2 :

Instead of this :

lg_btn = driver.find_element_by_xpath("//button[@class='btn btn-primary ml-2']")

Use this :

 lg_btn = driver.find_element_by_xpath("//button[@type='submit']")

Update 1 :

driver = webdriver.Chrome("C:\\Users\\Desktop\\Selenium+Python\\chromedriver.exe")
driver.maximize_window()
wait = WebDriverWait(driver, 30)
driver.get("https://golden77.com")
# print(driver.requests)
btn_login = wait.until(EC.element_to_be_clickable((By.XPATH, "//button[text()='Login']"))) #<button class="btn btn-primary ml-2">Login</button>
btn_login.click()
username = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "label.user-email-text+input[type='text']")))
username.send_keys("username")
password = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "label.user-email-text+input[type='password']")))
password.send_keys("password")
driver.execute_script("document.getElementsByName('example1')[0].click();")
lg_btn = driver.find_element_by_xpath("//button[@type='submit']") # login button
prop = lg_btn.get_property("disabled")
print(prop)
lg_btn.click()
cruisepandey
  • 6,860
  • 3
  • 9
  • 24
  • after trying your solution it give me this error. raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementClickInterceptedException: Message: Element is not clickable at point (453,292) because another element – User 111 May 21 '21 at 18:12
  • code i used . checkbox=driver.find_element_by_id("customCheck") checkbox.click() #check the checkbox sleep(10) lg_btn = driver.find_element_by_xpath("//button[@type='submit'") # login button – User 111 May 21 '21 at 18:13
  • @User111 : Updated the entire code, check it out under update 1 section. – cruisepandey May 22 '21 at 08:27
  • https://meta.stackoverflow.com/questions/354584/teaching-new-users-how-to-accept-an-answer – cruisepandey May 22 '21 at 13:26
  • I am scrapping live stream with python . But how can i show to my website? Suppose file name is data.mp4 and it's continually appended ? How to show live to my website? – User 111 May 23 '21 at 05:52
  • @User111 : At this point of time you cannot upvote, this ticket was specifically to login issue so if that is resolved you can accept this answer by clicking on check mark which is just beside this answer. for any new issue feel free to raise a different ticket. – cruisepandey May 23 '21 at 06:04