简体   繁体   English

AttributeError:模块“selenium.webdriver”在 Selenium webdriver 中没有属性“w3c”

[英]AttributeError: module 'selenium.webdriver' has no attribute 'w3c' in Selenium webdriver

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我正在尝试从键盘进行操作,我想从键盘按TAB键进行操作,但它对我来说是这个错误消息

AttributeError: module 'selenium.webdriver' has no attribute 'w3c' AttributeError:模块“selenium.webdriver”没有属性“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太感谢了

ActionChains() accepts the instance of a WebDriver as an argument. ActionChains()接受WebDriver的实例作为参数。

In this usecase, the WebDriver instance is self.driver where as you have passed webdriver在这个用例中, WebDriver实例是self.driver ,你已经通过了webdriver

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AttributeError: 模块“selenium.webdriver”没有属性“webdriver” - AttributeError: module 'selenium.webdriver' has no attribute 'webdriver' AttributeError:模块“selenium.webdriver”没有属性“find_element” - AttributeError: module 'selenium.webdriver' has no attribute 'find_element' AttributeError:模块'selenium.webdriver'没有属性'Chrome' - AttributeError: module 'selenium.webdriver' has no attribute 'Chrome' AttributeError 问题:模块“selenium.webdriver”没有属性“Chrome” - AttributeError Issue: module 'selenium.webdriver' has no attribute 'Chrome' 模块“selenium.webdriver”没有属性“PhantomJS” - module 'selenium.webdriver' has no attribute 'PhantomJS' 模块“selenium.webdriver”没有属性“get” - module 'selenium.webdriver' has no attribute 'get' AttributeError: 模块“selenium.webdriver”没有属性“Chrome”错误,使用 ChromeDriver 和 Chrome 通过 Selenium - AttributeError: module 'selenium.webdriver' has no attribute 'Chrome' error using ChromeDriver and Chrome through Selenium 没有名为“selenium.webdriver”的模块 - No module named 'selenium.webdriver' Selenium错误消息“ selenium.webdriver没有属性执行脚本” - Selenium error message “selenium.webdriver has no attribute execute script” AttributeError: 模块 'selenium.webdriver.chrome' 没有属性 'get' - AttributeError: module 'selenium.webdriver.chrome' has no attribute 'get'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM