Sleepy_time = sleepy_time if sleepy_time > first else (first + random()) Sleepy_time = round(random() * randint(first, second), 2) # and the number variable second (in seconds) # sleeps a random amount of time between the number variable in first # returns the value of the time slept (as float) In these cases, I usually use the following between the calls: from random import random, randint I've even run in to websites that require you to use send_keys 1 at a time for usernames and passwords to avoid some anti-scraping technologies they employ. Above all, it's important to watch your script execute and make sure that you're not getting any noticeable errors displayed on the webpage about the credentials that you're submitting.Īlso, however, some websites require that you add a certain minimum amount of time between the entry of the username, password, and submitting the page in order for it to be considered a valid submitting process. ![]() On many other websites, some of the necessary back-end processes are primed by client-side activities that are performed after the "submit" button is actually clicked (although on a side-note this is not considered best-practice because it makes the site less accessible, etc, I digress). It seems like you're having an XPATH problem finding the "Submit" button or your Submit button is not clickable, or your Submit button has some client side events attached to it (javascript/etc) that are required in order to effectively submit the page.Ĭalling the pw.submit() method in most cases should get rid of the need to wait for the submit button to become clickable and avoid any issues in locating the button in most cases. WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, Snapshot: Options.add_argument("-disable-extensions")ĭriver = webdriver.Chrome(chrome_options=options, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe') I have used the same xpath which you have constructed and you can use the following solution:Ĭode Block: from selenium import webdriver When you initialize the Chrome browser always in maximized mode.implies that the desired element was not interactable when you tried to invoke click() on it. I think there is some problem with Keys.ENTER, but I don't know how to solve this. Print("There was an error in selecting the header-login attribute on the page.")Ĭhrome_options.add_argument('-headless')Ĭhrome_options.add_argument('-no-sandbox')Ĭhrome_options.add_argument('-disable-dev-shm-usage')ĭriver = webdriver.Chrome('/usr/bin/chromium/chromedriver',chrome_options=chrome_options) It may be the page has not loaded properly.") Print("There was an error in selecting the email input field. #login = 20).until(EC.element_to_be_clickable((By.XPATH, is not None: This is the code where its getting error: from selenium import webdriverįrom import Byįrom import Keysįrom import NoSuchElementExceptionįrom import expected_conditions as ECįrom import WebDriverWaitįrom import Selectįrom import TimeoutExceptionįrom import Options ![]() Raise TimeoutException(message, screen, stacktrace) WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/support/wait.py", line 80, in until ![]() I understand this question has been asked but I need some solution for this error: Traceback (most recent call last):įile "goeventz_automation.py", line 405, in įile "goeventz_automation.py", line 149, in login
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |