Small white selenium learning,,, ask ace to give directions, thank you!
A foreign website, loading slowly, ready to use WebDriverWait control load time, when mark class='nPageEndTab appeared over loading,
The problem:
Target content has shown, but the browser or continue to load for a long time, stopped manually loaded, can print out the Next page, that mark is to be able to find, why WebDriverWait didn't work?
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
The from the selenium import webdriver
The from selenium.webdriver.com mon. By the import by
The from selenium.webdriver.com mon. Keys import keys
The from the selenium. Webdriver. Support the import expected_conditions as EC
The from the selenium. Webdriver. Support. Wait the import WebDriverWait
The from selenium.com mon. Exceptions import TimeoutException
The import time
Browser=webdriver. Chrome ()
Wait=WebDriverWait (browser, 2)
Try:
The get (' https://www.marketscreener.com/stock-exchange/shares/North-America-8/United-States-12/_gdBpxX/')
Elem=wait until (EC. Presence_of_element_located ((By CLASS_NAME, 'nPageEndTab)))
Print (elem. Get_attribute (" title "))
Except TimeoutException:
Print (' time out ')
Finally:
The close ()