0

I have this super simple code I'm trying to run on ChromeDriver but it's not working. The Java equivalent works fine. I want to open a new tab but any working way to send multiple keys would be great.

driver.get("https://www.google.com")
action = ActionChains(driver)
action.key_down(Keys.CONTROL).send_keys("t").key_up(Keys.CONTROL).perform()

Thanks in advance

2
  • you can refer to this question: stackoverflow.com/questions/28431765/… Commented Jan 23, 2021 at 3:39
  • @sunilbaba I saw that post before, it didn't work for me. I think something was patched that no longer allows sending multiple keys that way on Chrome. Keys.chord() no longer works for me in Java either Commented Jan 23, 2021 at 3:43

1 Answer 1

1

I haven't been able to get your method to work either, I'm not sure why. This did work for me though:

driver.execute_script("window.open('');")
Sign up to request clarification or add additional context in comments.

3 Comments

Also, after that, run driver.switch_to.window(driver.window_handles[1]) to interact with the new tab
What about sending chords in general? What if I want to press ctrl + 1?
I'm not sure, I think interacting with the pages themselves is fine, but interacting with chrome the browser you should use window_handles to navigate between them.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.