Using `send_keys(Keys.CONTROL + 't')` to open a new tab doesn't work and doesn't show any errors


Ant Unlimited

I'm trying to use this code to open multiple tabs, but either its syntax doesn't have any effect (i.e. the second tab doesn't open), or this code doesn't show any errors. it just opens google and then stops

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome(r'C:\chromedriver_win32\chromedriver')
driver.maximize_window()
driver.get('https://google.com')
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 't')'
cruise

This code should work for you:

Code:

driver.maximize_window()
driver.get("https://google.com")
url = "https://www.gmail.com"
driver.execute_script("window.open('"+url+"','_blank');");

Related


jQuery code doesn't work but also doesn't show any errors

Lionheart Nerd I have some jQuery code that calls into a separate PHP file (which also contains a jQuery countdown clock), and although no errors are displayed, no jQuery code seems to be loaded. The code I use to call the stats_bar.php file is: <?php if(i

Python asyncio doesn't show any errors

superman I am trying to get some data from thousands of URLs by using asyncio. Here is a brief overview of the design: QueuePopulate a bunch of URLs at once with one URLProducer generate a bunchConsumers Each Consumerkeeps fetching urls from Queueand sending G

Electron window doesn't open but doesn't show any errors

Jeff Context: I 've seen this question, but it doesn't solve my problem. When I try to run my electron app, I don't get any errors and it seems to compile, but the electron window doesn't pop up. Reply: Date: 2019-05-08T03:02:22.036Z Hash: 3303fd48d099a538493f

ionic cordova doesn't build but doesn't show any errors

Tristan I just made a "new" ionic app, but I can't get Cordova to build the APK. I put the new quotes because I created a new project and copied over from the previous project's src. Something went horribly wrong with the dependencies of the plugin installed o

The link doesn't open in a new tab

Alan Weber Here is my javascript code, I want the link should open in new tab but it doesn't happen, how can I do that? <link href="http://vjs.zencdn.net/5.4.6/video-js.min.css" rel="stylesheet"> <script src="http://vjs.zencdn.net/5.4.6/video.min.js"></script>

Ajax doesn't work. it doesn't show any errors

Ati I am using Ajax in my application. Previously it worked fine and checked many times. Not working now. I didn't change anything in this code. I checked the URL path and also checked the Jquery click event. It doesn't show any errors in the console log. $(".

Electron window doesn't open but doesn't show any errors

Jeff Context: I 've seen this question, but it doesn't solve my problem. When I try to run my electron app, I don't get any errors and it seems to compile, but the electron window doesn't pop up. Reply: Date: 2019-05-08T03:02:22.036Z Hash: 3303fd48d099a538493f

Python asyncio doesn't show any errors

superman I am trying to get some data from thousands of URLs by using asyncio. Here is a brief overview of the design: QueuePopulate a bunch of URLs at once with one URLProducer generate a bunchConsumers Each Consumerkeeps fetching urls from Queueand sending G

jQuery code doesn't work but also doesn't show any errors

Lionheart Nerd I have some jQuery code that calls into a separate PHP file (which also contains a jQuery countdown clock), and although no errors are displayed, no jQuery code seems to be loaded. The code I use to call the stats_bar.php file is: <?php if(i

PHP doesn't show any errors

UserIsCorrupt I know this question has been asked many times in the past, but none of the solutions worked for me. Here is my PHP code: <?php function ?> This should generate an error. However, it just returns a 500 error and doesn't load. I tried the less

Electron window doesn't open but doesn't show any errors

Jeff Context: I 've seen this question, but it doesn't solve my problem. When I try to run my electron app, I don't get any errors and it seems to compile, but the electron window doesn't pop up. Reply: Date: 2019-05-08T03:02:22.036Z Hash: 3303fd48d099a538493f

Left click on link doesn't work, but "open in new tab" works

rock degree I'm working on my personal website (built from a template) and when I'm done, my links stop responding to left clicks. They work fine if you right click and select "Open in New Tab". You can see the URL in the status bar at the bottom of the browse

Left click on link doesn't work, but "open in new tab" works

rock degree I'm working on my personal website (built from a template) and when I'm done my links stop responding to left clicks too. They work fine if you right click and select "Open in New Tab". You can see the URL in the status bar at the bottom of the bro

pygame.font doesn't work and doesn't show any errors

Amar Prakash Pandey Everything works fine except the font, I don't know why this is happening, it doesn't even show any errors. without displaying the text on the screen. # import library here import pygame import time import sys # display init display_width

jQuery code doesn't work but also doesn't show any errors

Lionheart Nerd I have some jQuery code that calls into a separate PHP file (which also contains a jQuery countdown clock) and although no errors are displayed, no jQuery code seems to be loaded. The code I use to call the stats_bar.php file is: <?php if(is

Python asyncio doesn't show any errors

superman I am trying to get some data from thousands of URLs by using asyncio. Here is a brief overview of the design: QueuePopulate a bunch of URLs at once with one URLProducer generate a bunchConsumers Each Consumerkeeps fetching urls from Queueand sending G

ionic cordova doesn't build but doesn't show any errors

Tristan I just made a "new" ionic app, but I can't get Cordova to build the APK. I put the new quotes because I created a new project and copied over from the previous project's src. Something went horribly wrong with the dependencies of the plugin installed o

Python asyncio doesn't show any errors

superman I am trying to get some data from thousands of URLs by using asyncio. Here is a brief overview of the design: QueuePopulate a bunch of URLs at once with one URLProducer generate a bunchConsumers Each Consumerkeeps fetching urls from Queueand sending G

Left click on link doesn't work, but "open in new tab" works

rock degree I'm working on my personal website (built from a template) and when I'm done my links stop responding to left clicks too. They work fine if you right click and select "Open in New Tab". You can see the URL in the status bar at the bottom of the bro

jQuery code doesn't work but also doesn't show any errors

Lionheart Nerd I have some jQuery code that calls into a separate PHP file (which also contains a jQuery countdown clock), and although no errors are displayed, no jQuery code seems to be loaded. The code I use to call the stats_bar.php file is: <?php if(i