Selenium with Chrome throws an error upon execution



  • Hi Ranjith, hope you are doing fine. Running my script using PhantomJS, I find desired results. However, when I run the same using chrome, It breaks throwing an error - "Disable developer mode extensions". I tried a lot to bring results using chrome but fails miserably. How can I make a go? Any help on this will be highly appreciated. Thanks in advance.


  • administrators

    It's a known issue. Here's how to solve it - https://github.com/florentbr/SeleniumBasic/issues/122



  • Thanks Ranjith, for your response. Although it's a known issue, I could find any solution nowhere. However, you are very close. The browser is not showing the "disable extension" tag but a blank page is there instead. I'm stuck at this point. Please, do let me know If I'm wrong with what I'm doing. The code I tried with:

    Sub Selenium_Testing()
    Dim webdriver As Object
    Dim posts As Object, post As Object
    Browser = "chrome"
    
    Set webdriver = CreateObject("Selenium.WebDriver")
    
    With webdriver
        .AddArgument ("--no-sandbox")
        .AddArgument ("--disable-extensions")
        .Start Browser, "https://redmart.com"
        .get "/bakery"
    End With
    
    Set posts = webdriver.FindElementsByXPath("//li[@class='productPreview  ']")
    
    For Each post In posts
        i = i + 1
        Cells(i, 1) = post.FindElementByXPath(".//h4/a").Text
    Next post
    End Sub


  • I've got it sorted. Turn out that when I downloaded the updated chromedriver.exe and pasted it to this folder "C:\Program Files\SeleniumBasic", It works like magic without adding any argument in my script.


Log in to reply
 

Looks like your connection to Codingislove Forum was lost, please wait while we try to reconnect.