I'm attempting to launch the devtools in a chrome browser on Linux by using the keyboard shortcuts. Because I'm using Ruby and it does not have a chord method, I've tried the following:
driver.action.key_down(:shift)
.key_down(:control)
.send_keys("i")
.key_up(:shift)
.key_up(:control)
.perform
The above code will work in Firefox (as suggested in Key press in (Ctrl+A) Selenium WebDriver), but in chrome, it returns nil but no results occur.
Any advice?
We can send keyboard shortcut ALT SHIFT z(hotkey) with Selenium webdriver. This can be done with the help of the Keys class. We shall use the Keys. chord method and pass Keys.
Selenium provides various ways to automate these Keyboard Events, a few of which are: Automate keyboard events using the sendKeys() method of WebElement class. Automate keyboard events using Robot class. And Automate keyboard events using Actions class.
Selenium is a browser-based test framework that allows one to automate user actions and interactions with web applications. You can use Selenium WebDriver APIs to devise test code using Selenium-supported languages like Ruby, Java, JavaScript, C#, and Python.
In Selenium I have used :
function key F12.
driver.FindElement(By.XPath("String")).SendKeys(Keys.F12);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With