from selenium import webdriver # pip install selenium
from selenium.webdriver.common.keys import Keys
import time
import random
import sys
#op = webdriver.ChromeOptions()
#op.add_argument('headless')
def print_same_line(text):
sys.stdout.write('r')
sys.stdout.flush()
sys.stdout.write(text)
sys.stdout.flush()
class Join:
def join_link():
driver = webdriver.Chrome()
driver.get("https://meetingsapac29.webex.com/meet/pr1566903906")
driver.maximize_window()
time.sleep(4)
click = driver.find_element_by_xpath('//*[@id="push_download_join_by_browser"]')
click.click()
time.sleep(10)
input_name = lambda: driver.find_element_by_xpath('//*[@id="meetingSimpleContainer"]/div[2]/div[2]/input')
input_name.clear()
input_name.send_keys(Name)
input_email = lambda: driver.find_element_by_xpath('//*[@id="meetingSimpleContainer"]/div[2]/div[3]/input')
input_email.clear()
input_email.send_keys(Email)
if __name__ == "__main__":
name = ["Rutul","Satyajit","Swaraj"]
email = ["rutulkmr10@gmail.com","Satyajit2003@gmail.com","Swaraj12@gmail.com"]
Name = random.choice(name)
Email = random.choice(email)
Join.join_link()
错误:
File "webhook.py", line 44, in <module>
Join.join_link()
File "webhook.py", line 29, in join_link
input_name.clear()
AttributeError: 'function' object has no attribute 'clear'
AttributeError: 'function' object has no attribute 'send_keys'
这个错误让我很紧张如果有人知道如何解决这个问题,请帮助selenium Keys.py没有任何Clear、send_Keys等功能。一切都很好,但当涉及到sendkeys和clear函数时,它显示了about错误!如果有人知道解决方案,请帮忙。
driver = webdriver.Chrome()
driver.get("http://www.google.com")
box = driver.find_element(By.NAME, "q")
box.send_keys("aabb")
box.clear()
lambda:一个函数,不能调用此函数。您将一个函数分配给变量del lambda:,然后重试。