cohhi / application-Test

软件测试
http://411.free.svipss.top/blog/resources/applicationtest/index.html
0 stars 0 forks source link

selenium按键api无效 #2

Closed cohhi closed 1 year ago

cohhi commented 1 year ago

example

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome()
driver.get("http://411.free.svipss.top/blog/resources/applicationtest/resources/steam-404/steam-404Selenium.html")
driver.find_element_by_tag_name("html").send_keys(Keys.F12)
cohhi commented 1 year ago

ctrl a 全选功能正常

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get("http://411.free.svipss.top/blog/resources/applicationtest/resources/steam-404/steam-404Selenium.html")
body = driver.find_element(by=By.CSS_SELECTOR, value="*")
body.send_keys(Keys.CONTROL,'a')
cohhi commented 1 year ago

ActionChains同样无效

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Chrome()
driver.get("http://411.free.svipss.top")
action = ActionChains(driver)
action.send_keys(Keys.F12)
action.perform()