简体   繁体   中英

Find driver element with Python

I am trying to download a file from 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.

An error appears as follows:

TypeError: Object of type builtin_function_or_method is not JSON serializable

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM