Using Edge with Selenium?

I have successfully replicated Chrome and Firefox to work with Replit using others examples but was unable to replicate the browser I truly need for my purposes. I have been trying to launch Edge using selenium within the Replit Online IDE to no prevail.

I have tried pip installing msedge-selenium-tools, selenium alone, and more. Nothing seems to work. I tried following a Selenium Replit Tutorial for chrome and changing chrome in for edge but had no luck in getting Edge to launch. Something not included in the tutorial but in the comments is the step of adding package dependencies to allow chrome to run. The example comment shows that the nix package dependencies for Chrome are:

pkgs.chromium & pkgs.chromedriver

Maybe if I find & add in the Edge equivalent, the program will actually open with Edge browser.

replit.nix file contents:

{ pkgs }: {
  deps = [
pkgs.python38Full
];
env = {
  PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
    # Needed for pandas / numpy
  pkgs.stdenv.cc.cc.lib
  pkgs.zlib
  # Needed for pygame
  pkgs.glib
  # Needed for matplotlib
  pkgs.xorg.libX11
];
PYTHONBIN = "${pkgs.python38Full}/bin/python3.8";
LANG = "en_US.UTF-8";
};
}

Code:

from selenium import webdriver
from selenium.webdriver.edge.options import Options
import time
# Error: 'Options' object has no attribute add_argument
#edge_options = Options()
#edge_options.add_argument('--no-sandbox')
#edge_options.add_argument('--disable-dev-shm-usage')

#driver = webdriver.Edge(options=edge_options)
# ERROR #1: FileNotFoundError: [Errno 2] No such file or directory: 'MicrosoftWebDriver.exe
# ERROR #2: raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'MicrosoftWebDriver.exe' executable needs to be in PATH. Please download from http://go.microsoft.com/fwlink/?LinkId=61...
driver = webdriver.Edge()
driver.get('https://www.google.com')

time.sleep(20)

Error screenshot:

code + errors

Addionally, I get a ‘Error: ‘Options’ object has no attribute add_argument’ when trying to follow the tutorial using Chrome and changing to Edge.

Hi @Quinnow57 thanks for your question.

I’m not sure about specific Edge package names but I’ll ask the Replit team and update this topic if they have any insights.

Have you read through this article? It might help Use WebDriver to automate Microsoft Edge - Microsoft Edge Development | Microsoft Docs

Can you please also post a link to your Repl so users in the community can suggest some ideas?

Here is a link to the replit: EdgeSeleniumTest - Replit

I’ve tried everything to get selenium to launch with Edge, no luck still :frowning:

Hi @Quinnow57 I noticed when I ran your Repl that there seems to be an issue with running anything in Shell e.g. pip. I’ve raised this as a helpdesk call and will get back to you when I have more info.

If in the meantime you could try creating a brand new Repl and paste the code in to see if you get the same error it would be much appreciated. There was an issue with Python repls on Weds/Thurs which was resolved and it doesn’t seem like the same issue but… just in case!

Had to create this temporary account because unfortunately my main wouldn’t allow me to reply but here is the new replit: Edge Selenium Attempt 2 - Replit

Same errors unfortunately:

Thanks @quinnow57_temp @Quinnow57 I’ll let you know when support have further information.

Hi @Quinnow57 @quinnow57_temp currently msedgedriver isn’t part of Nix which is why you are seeing the error messages. Sorry I can’t help you further here but at least we know the reason for the error message.

I’ll suggest this as a feature via the Loading... - Form by Asana feedback option.

1 Like

It’s unfortunate it isn’t a supported feature yet, hopefully it will be some day.

Thank you so much for replying and being very helpful.

1 Like