It seems like the problem is not with the XPath, CSS or class that you are using to find the sign-in button, but rather with the login functionality itself. When you try to login manually, it works fine, but when you try to login using Selenium Python, it fails with an error message.
Here are some suggestions you can try:
1 Wait for the element to be clickable: Sometimes, the element may not be clickable immediately after it loads on the page. You can wait for the element to become clickable by using an explicit wait condition. You can use the ExpectedConditions.element_to_be_clickable
method to wait for the element to become clickable. Here's an example:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
wait = WebDriverWait(driver, 10)
element = wait.until(EC.element_to_be_clickable((By.XPATH, "/html/body/ui-layout/div/div/div[1]/login/login-sts/div/div/div[1]/form/div/div[4]/button")))
element.click()
This will wait for a maximum of 10 seconds for the element to become clickable. You can adjust the timeout value as per your requirement.
2 Try logging in with valid credentials: Sometimes, the website may block automated login attempts with invalid credentials. Make sure that you are using valid credentials to login.
3 Try disabling browser automation detection: Some websites may detect and block automated login attempts. You can try disabling browser automation detection by setting the navigator.webdriver
property to False
. Here's an example:
driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
This will disable the navigator.webdriver
property, which is used by websites to detect browser automation.
4 Try using a different browser: Sometimes, the website may have issues with certain browsers. You can try using a different browser to see if it works.
I hope these suggestions help you resolve the issue.