17

I would like to start writing some selenium scripts using Visual Studio Code.

Can I install the webdriver(s) and how?

In the demonstration video's that I have seen Visual Studio was used, not VSC.

Please guide me since I am not familiar with the VSC editor.

Patrick Kwinten
  • 1,988
  • 2
  • 14
  • 26

3 Answers3

15

Yes you can. Step 1: Open the VS Code and Install the Nuget Package Manager using the VS code extension (Ctrl+Shift+X)

Step 2: Then go to the Command Pallette of VS Code(Ctrl+Shift+P), Search for Nuget Package Manager : Add Package and then Search for Selenium.Webdriver

You can read more about it here

  • Re "_Install the Nuget Package Manager_" there are at least 6 NPM (with and w/o GUI) in _Extensions: Marketplace_ from different authors here. Which one is the "official" or recommended one? – Gerold Broser Jun 13 '23 at 15:59
3

For the entry-level selenium automation tester, there are some issues and errors to run the java selenium program on a Linux system. So if you are creating a normal java project on selenium:

  • Step 1: Download and set a path for java

  • Step 2: Must use vs code insider

  • Step 3: Install Java Extension Pack for Visual Studio Code

  • Step 4: Create a new standalone Java project => click “Create Java Project”[if not available Click Ctrl+Shift+P search: Create Java Project] => select standalone (no build tools) => name the project => a new vs Code window will be created with the new project; the new project will have a lib and src folder, “Hello World” java file, and a Readme

  • Step 5: Download Selenium Webdriver =>Download the latest stable Selenium Web Driver for Java – this will be a zip file: (e.g. selenium-java-3.141.59.zip) =>unzip the file and there will be multiple jar files – it’s important to add ALL the jar files to the project’s dependencies => we need client-combined-3.141.59.jar for compiling our Selenium code => we need the rest of the jars for running Selenium

  • Step 6: Add jar files =>add all 7 jars to the project by clicking the “+” next to Referenced Libraries (on downside java project on referenced libraries )

  • Step 7: Setting up ChromeDriver => Download The ChromeDriver major version has to match your Chrome version. =>unzip ChromeDriver zip and move it to a central folder that will be referenced by multiple projects (For Linux no need to give path)

  • Step 8: On the downside on Java Project "|->" click to Export jar Now your setup is ready to run

ouflak
  • 2,458
  • 10
  • 44
  • 49
0

I had same issue I just used pip install and it worked.

pip install selenium
Tyler2P
  • 2,324
  • 26
  • 22
  • 31