Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chromedriver launch new tab
#4
(Feb-10-2019, 06:39 PM)metulburr Wrote: I dont believe you can use selenium without using the driver. What popup window are you referring to? A popup can be dismissed via selenium. driver.switch_to can handle switching windows such as popups or tabs. In which you would switch to it and close it, then return to the parent window. You can also try to dismiss notifications before via something similar to this depending on what popup you are talking about
    def chrome_prep(self):
        '''get rid of asking to save password and notifications popup'''
        chrome_options = webdriver.ChromeOptions()
        chrome_options.add_experimental_option(
            'prefs', {
                'credentials_enable_service': False,
                "profile.default_content_setting_values.notifications" : 2,
                'profile': {
                    'password_manager_enabled': False
                }
            }
        )
        return chrome_options
         
    def setup_chrome(self):
        options = self.chrome_prep()
        self.browser = webdriver.Chrome(CHROMEPATH, chrome_options=options)
You can open a new tab via javascript driver.execute_script("window.open('');") and then switch to it and open a url. Such as:
    #driver.get("https://malaysia.yahoo.com/?p=us")
    driver.execute_script("window.open('');")
    driver.switch_to.window(driver.window_handles[1])
    driver.get('https://python-forum.io')
    driver.switch_to.window(driver.window_handles[0])
    driver.get('https://malaysia.yahoo.com/?p=us')
You can build an exe using Pyinstaller

Whenever I launch the chromedriver.exe it will popped 1 new window, and I don't want it be showed.
Capture


Regarding the chrome_options, I don't know why I can't execute as I did follow online example.
It said, "use options instead of chrome_options"

Regarding the tab via JavaScript, how can I check? If Chrome Broswer is open then open as new tab, else open new Chrome Browser.

Thanks.
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,096 Apr-13-2023, 09:20 PM
Last Post: Clixmaster
  enable flash using selenium chromedriver Fre3k 1 4,295 Nov-27-2020, 12:15 PM
Last Post: JellyCreeper6
  WebDriverException: 'chromedriver' executable needs to be in PATH pyzyx3qwerty 9 12,768 Jun-09-2020, 05:43 PM
Last Post: Yoriz
  Selenium Chromedriver Automation Help lessthanthree 1 2,161 May-05-2020, 11:03 PM
Last Post: Larz60+
  How to identify chromedriver version? metulburr 2 7,667 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