from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup as b
import time
class Login:
def __init__(self, driver, username, password):
self.driver = driver
self.username = username
self.password = password
def signin(self):
print('opening')
self.driver.get('https://www.instagram.com/accounts/login/?source=auth_switcher')
uid = WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, '#react-root > section > main > article > div.rgFsT > div:nth-child(1) > div > form > div:nth-child(2) > div > label > input')))
uid.click()
uid.send_keys(self.username)
pswd = self.driver.find_elements_by_css_selector('#react-root > section > main > article > div.rgFsT > div:nth-child(1) > div > form > div:nth-child(3) > div > label > input')
pswd.click()
pswd.send_keys(self.password)
btn = self.driver.find_elements_by_css_selector('#react-root > section > main > article > div.rgFsT > div:nth-child(1) > div > form > div:nth-child(4)')
btn.click()
time.sleep(3)
答案 0 :(得分:0)
模块'selenium.webdriver.support.expected_conditions'没有'presence_of_elements_located'成员;也许是“ presence_of_element_located”?
Date().nextHalfHour // "May 23, 2020 at 1:00 AM"