Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chromedriver launch new tab
#1
So I planned to make a GUI for my application which contains several buttons.
Each button will open chrome browser and redirect to specific URLs.
So this is my sample GUI code, but will enhance the code to look more perfect.

from tkinter import *
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import time

window = Tk()
window.title("Welcome to MyApp")
window.geometry('350x200')

def google():
    chrome_options = Options()
    chrome_options.add_argument("--disable-infobars")
    chrome_options.add_argument("--headless")
    chrome_options.add_argument('--disable-gpu')
    chrome_options.add_argument('--log-level=3')

    driver = webdriver.Chrome(executable_path=r'chromedriver.exe')
    driver.get("https://www.google.com")
 
btnGoogle = Button(window, text="Google", command=google)
btnGoogle.grid(column=0, row=0)

def yahoo():
    chrome_options = Options()
    chrome_options.add_argument("--disable-infobars")
    chrome_options.add_argument("--headless")
    chrome_options.add_argument('--disable-gpu')
    chrome_options.add_argument('--log-level=3')

    driver = webdriver.Chrome(executable_path=r'chromedriver.exe')
    driver.get("https://malaysia.yahoo.com/?p=us")

btnYahoo = Button(window, text="Yahoo", command=yahoo)
btnYahoo.grid(column=1, row=0)

window.mainloop()
EDIT
I think I'll use another application to create the fancy GUI and to trigger the .py/.exe file. (1 button will trigger 1 .py/.exe file)
So there are few things I wanna do ask.
  1. How to launch default google chrome browser instead of chromedriver.exe (To avoid the pop-up window when executed chromedriver.exe)
  2. How to launch as new tab and redirect to specific URLs, if the chrome browser is already opened, else open new browser window.
  3. How to convert .py to .exe file
Reply


Messages In This Thread
Chromedriver launch new tab - by gahhon - Feb-10-2019, 03:57 PM
RE: Chromedriver launch new tab - by Larz60+ - Feb-10-2019, 06:31 PM
RE: Chromedriver launch new tab - by metulburr - Feb-10-2019, 06:39 PM
RE: Chromedriver launch new tab - by gahhon - Feb-11-2019, 02:55 PM
RE: Chromedriver launch new tab - by metulburr - Feb-11-2019, 09:21 PM
RE: Chromedriver launch new tab - by gahhon - Feb-13-2019, 02:08 PM
RE: Chromedriver launch new tab - by metulburr - Feb-13-2019, 10:35 PM
RE: Chromedriver launch new tab - by gahhon - Feb-14-2019, 04:09 PM
RE: Chromedriver launch new tab - by metulburr - Feb-15-2019, 04:56 PM
RE: Chromedriver launch new tab - by gahhon - Feb-16-2019, 07:39 AM
RE: Chromedriver launch new tab - by metulburr - Feb-16-2019, 01:39 PM
RE: Chromedriver launch new tab - by gahhon - Feb-16-2019, 07:00 PM
RE: Chromedriver launch new tab - by gahhon - Feb-16-2019, 10:04 PM
RE: Chromedriver launch new tab - by metulburr - Feb-17-2019, 12:04 AM
RE: Chromedriver launch new tab - by gahhon - Feb-17-2019, 04:13 PM
RE: Chromedriver launch new tab - by metulburr - Feb-17-2019, 06:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Selenium undetected Chromedriver Bot Laurin0000 1 4,092 Apr-13-2023, 09:20 PM
Last Post: Clixmaster
  enable flash using selenium chromedriver Fre3k 1 4,294 Nov-27-2020, 12:15 PM
Last Post: JellyCreeper6
  WebDriverException: 'chromedriver' executable needs to be in PATH pyzyx3qwerty 9 12,767 Jun-09-2020, 05:43 PM
Last Post: Yoriz
  Selenium Chromedriver Automation Help lessthanthree 1 2,160 May-05-2020, 11:03 PM
Last Post: Larz60+
  How to identify chromedriver version? metulburr 2 7,665 Jun-13-2019, 11:37 PM
Last Post: metulburr
  chromedriver.exe issue gahhon 2 2,831 Feb-12-2019, 12:09 PM
Last Post: metulburr
  Selenium chromedriver and click action Gilles95 4 13,301 Feb-07-2018, 07:28 PM
Last Post: Gilles95

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020