需要在使用Selenium Python打开时将Google Chrome打开至全屏
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.get("http://google.com")
答案 0 :(得分:0)
试试这个:
driver = webdriver.Chrome()
driver.get("http://google.com")
actions = ActionChains(driver)
actions.key_down(Keys.SHIFT).send_keys('f').key_up(Keys.SHIFT).perform()
答案 1 :(得分:0)
(1)使用动作类: -
Actions builder = new Actions(driver);
builder.keyDown(Keys.CONTROL).click(driver.findElement(locator)).keyUp(Keys.CONTROL).build().perform();
(2)使用机器人类
Robot r=new Robot();
r.keyPress(KeyEvent.VK_SHIFT);
r.keyPress(KeyEvent.VK_META);
r.keyPress(KeyEvent.VK_F);
r.keyRelease(KeyEvent.VK_SHIFT);
r.keyRelease(KeyEvent.VK_META);
r.keyRelease(KeyEvent.VK_F);
(3)使用Keys类
Keys.chord(Keys.CONTROL, "a"); [Form your OWN]