[英]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.