我必须在我的剧本中添加秒表
mosaic_plot(df,
{"AA":"r", "BB":"b", "CC":"y", "DD":"g"}, # dict of color, mandatory
x_label='My Category',
)
在此代码之后它应该保持一段时间(5秒),而不是其他人员,如下所示:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
start = time.clock()
driver = webdriver.Firefox()
driver.get('https://ebay.com')
怎么做?
答案 0 :(得分:1)
我花了很多时间,在上帝和StackOverflow的许多人的帮助下,我终于解决了它。
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
driver = webdriver.Firefox()
driver.get(''https://ebay.com'')
delay = 30
try:
myElem = WebDriverWait(driver, delay).until(EC.presence_of_element_located((By.ID, 'username')))
element = driver.find_element_by_id("username")
element.send_keys("some text")
except TimeoutException:
print ("Loading took too much time!")
在我看来,这将是最好的。