pythonseleniumwebdriverpython-webbrowserfindelement

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

Solution

  • 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.