0

I'm trying to make an action from keyboard that I would like to make an action press TAB key from keyboard but it through for me this error message

AttributeError: module 'selenium.webdriver' has no attribute 'w3c'

This is my code for that

from selenium import webdriver
import unittest
import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from Pages.loginPage import LoginPage

class createDevice(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.driver = webdriver.Chrome(executable_path="C:/Users/Admin/PycharmProjects/admin/Drivers/chromedriver.exe")
        cls.driver.maximize_window()
        driver = cls.driver
        driver.get("https://admin-helper-f21c1.web.app/login")
        login = LoginPage(driver)
        login.enter_email("admin@gmail.com")
        login.enter_password("123456")
        login.click_login()
        cls.driver.implicitly_wait(10)

    def test_create_device_03(self):
        self.driver.find_element_by_xpath('//*[@id="sidebar"]/ul/li[2]/a').click()
        time.sleep(2)
        self.driver.find_element_by_xpath("//main//div/button[@type='button']").click()
        self.driver.find_element_by_xpath("//input[@id='name']").send_keys(" ")
        action = ActionChains(webdriver)
        action.send_keys(Keys.TAB)
        self.driver.find_element_by_xpath("//div[text()=' Device name is required. ']").is_displayed()
        print("'Device name is required.' displayed")
        time.sleep(2)

Could anyone explain to me what does that mean and how can I fix this problem? I already search for it but I did not found the answer to work for me. Please help me! thank you so much

kite10
  • 3
  • 3

1 Answers1

0

ActionChains() accepts the instance of a WebDriver as an argument.

In this usecase, the WebDriver instance is self.driver where as you have passed webdriver

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352