Automating Dropdown Menu, Select and Send Keys

Refresh

1 weeks ago

Views

9 time

0

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

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 selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.common.exceptions import TimeoutException



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

    def driver_load_page(self):
        self.driver.get("https://vurku.com/")
        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)
    myclass.driver_load_page()
    myclass.driver_pass_username_keys()

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

0

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

Вот

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