from selenium import webdriver
import time
from datetime import datetime
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver.get('https://www.toster.ru')
time.sleep(3)
driver.find_element_by_xpath('//a[@class="btn btn_green btn_add-question"]').click()
time1 = datetime.now()
try:
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.XPATH, "//textarea[@class='field__input textarea']"))
)
finally:
time2 = datetime.now()
delta = time2 - time1
print(delta)
{1: 7, // 1 в 1, 12, 123, 11, 1, 12, 12
12: 4,
etc}
?{12: 3,
1: 2,
etc}
?from collections import OrderedDict
d = map(str,[1,12,123,11,3,12,12])
OrderedDict(sorted({i: len([j for j in d if j.startswith(i)]) for i in d}.items(), key=lambda x: x[1], reverse = True))
OrderedDict(sorted({i:d.count(i) for i in d}.items(), key=lambda x: x[1], reverse=True))