For Selenium With Python, How Can I Get It To Press Ctrl, Shift, I?
I have just started taking a Python class and is my first experience with programming, other than a little HTML. I am trying to write a script for Instagram and would like to be ab
Solution 1:
Please try to send keys with ActionChains
self.driver = webdriver.Chrome(executable_path=r"C:\path\to\chromedriver.exe")
actions = ActionChains(self.driver)
actions.send_keys(Keys.CTRL, Keys.SHIFT, "i")
actions.perform()
Imports would be
from selenium import webdriver
from selenium.webdriver.common.keysimportKeysfrom selenium.webdriver.common.action_chainsimportActionChains
Solution 2:
Keys looks a little bit hacky.
Please try with this:
from selenium importwebdrivermobile_emulation= { "deviceName": "Nexus 5" }
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities = chrome_options.to_capabilities())
Post a Comment for "For Selenium With Python, How Can I Get It To Press Ctrl, Shift, I?"