Some said that it is necessary to set waiting time, otherwise it may cause NoSuchElementException
error because the page didn't finish loading.
However, I tried the following code (without any waiting lines) with a low-speed network (I limited the speed), and the login process still ran smoothly (it kept loading at first, and when I canceled the limit, the loading finished immediately and things went on...).
from selenium import webdriver
import json
# Get user info
with open('wjxlogin.json', encoding='utf-8') as fp_login:
login = json.load(fp_login)
username = login['username']
password = login['password']
# First login
browser = webdriver.Firefox()
browser.get('https://www.wjx.cn/login.aspx')
browser.find_element_by_id('UserName').send_keys(username)
browser.find_element_by_id('Password').send_keys(password)
browser.find_element_by_id('RememberMe').click()
browser.find_element_by_id('LoginButton').click()
So, I wonder if there's an automatic waiting mode in current Selenium, which does not allow executing the next line until the last process is finished? And is it still necessary to set a waiting time (in my code for example)?