Automating Dropdown Menu, Select and Send Keys


February 2019


9 time


I am trying to automate some functions for a webpage. Specifically my goal is to automate within the "Download posts by username" section of

Whereby I pass username info to the "username" section, click and select images from the "post type" section, and click download.

However I can not seem to pass the username keys into the username section, and am getting an error that states:

line 20, in driver_pass_username_keys
self.driver.find_element(By.XPATH, "//* [@id='collection_username']").sendkeys("guendouglas")
AttributeError: 'FirefoxWebElement' object has no attribute 'sendkeys'

I have worked through many different versions of this code, as I am new to python and selenium, but since I am rather new I am lost. This code worked when I didn't program it from an object oriented perspective. But I'm trying to practice OOP.

from selenium import webdriver
from import WebDriverWait
from import expected_conditions as EC
from import By
from import Select
from selenium.common.exceptions import TimeoutException

class AutomateVurku:
    def __init__(self,driver):
        self.driver = driver

    def driver_load_page(self):
        return WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.ID, "collection_username")))

def driver_pass_username_keys(self):
    self.driver.find_element(By.XPATH, "//*[@id='collection_username']").sendkeys("guendouglas")

#    def driver_select_image_dropdown(self):

if "__main__" == __name__:
    driver = webdriver.Firefox(executable_path="/Users/alexandrubordei/Desktop/geckodriver")
    myclass = AutomateVurku(driver)

as stated, I am receiving an error that states that FireFoxWebElement doesn't have an attribute "send keys"

I am not sure what that even means

1 answers


Я думаю, это был уже ответили под этим вопросом:


Надеюсь, поможет.