How to run Selenium tests on the Brave web browser?

后端 未结 4 2160
天命终不由人
天命终不由人 2020-12-29 10:25

I am trying to run some Selenium tests on the Brave web browser. I am able to start the Brave web browser through Selenium by using the ChromeDriver. However, nothing else w

相关标签:
4条回答
  • 2020-12-29 11:03

    Thanks, @BarneyKelly, works like a charm! In python3 (Linux Mint 2020) I used:

    def abre_navegador(self):
        # Avenue_Basico.wd = webdriver.Firefox()   # Criar instância do navegador 
        # Avenue_Basico.wd = webdriver.Chrome()   # Criar instância do navegador
    
        options = Options()
        options.binary_location = '/usr/bin/brave-browser'
        driver_path = '/usr/local/bin/chromedriver'
        self.wd = webdriver.Chrome(options = options, executable_path = driver_path)
    

    Again, Thank You for your help.

    0 讨论(0)
  • 2020-12-29 11:05

    System:
    macOS Catalina 10.15.2
    Python 3.7.4
    pytest 5.3.2
    selenium 3.141.0
    ChromeDriver 79.0.3945.36
    Brave 1.1.23 Chromium: 79.0.3945.88 (Official Build) (64-bit)

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    
    options = Options()
    options.binary_location = '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser'
    driver_path = '/usr/local/bin/chromedriver'
    drvr = webdriver.Chrome(options = options, executable_path = driver_path)
    drvr.get('https://stackoverflow.com')
    

    Reference:
    Set chrome browser binary through chromedriver in Python

    0 讨论(0)
  • 2020-12-29 11:06

    for windows user path must be relative in your case

    System.setProperty("webdriver.chrome.driver","E:\\WEBDRIVER PLUGINS\\chromedriver_win32\\chromedriver.exe");
    ChromeOptions options = new ChromeOptions().setBinary("C:\\Program Files (x86)\\BraveSoftware\\Brave-Browser\\Application\\brave.exe");
    WebDriver driver = new ChromeDriver(options);
    
    0 讨论(0)
  • 2020-12-29 11:20

    For the record: this is no longer an issue since Brave went full-Chromium (starting from version 0.57). I can now pass instructions to the WebDriver by initializing it using the code snippet included in the question.

    Nevertheless, be sure to check that your ChromeDriver version is compatible with your Brave Browser version.

    0 讨论(0)
提交回复
热议问题