[英]Find driver element with Python
I am trying to download a file from MS Edge.我正在尝试从 MS Edge 下载文件。 The webpage is protected by a username and a password.
该网页受用户名和密码保护。 I am able to open up MS Edge, and navigate to the appropriate page, however, I can't navigate the UserName and PassWord box.
我能够打开 MS Edge,并导航到相应的页面,但是,我无法导航用户名和密码框。
An error appears as follows:出现错误如下:
TypeError: Object of type builtin_function_or_method is not JSON serializable类型错误:builtin_function_or_method 类型的 Object 不是 JSON 可序列化的
I have tried a larger program, but broke it down to the following simple steps, since I am in debugging-mode:我尝试了一个更大的程序,但由于我处于调试模式,所以将其分解为以下简单步骤:
import time
from selenium import webdriver
driver = webdriver.Edge() #Edge opens
time.sleep(3)
driver.get("my_URL") #Webpage opens
time.sleep(3)
id_box = driver.find_element(id,"correct_id") #Error Occurs
You'll need to search like that:您需要这样搜索:
from selenium.webdriver.common.by import By
id_box = driver.find_element(By.ID,"correct_id")
Because only id
isn't a valid object.因为只有
id
不是有效的 object。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.