Setting up your own test automation environment - Learn web development | MDN

This is regarding the instructions under the header Setting up Selenium in Node

I have downloaded GeckoDriver and ChromeDriver, as instructed, and have placed them both in my personal Users folder (MacOS), in my "personal name"s folder.

And I have opened my .bash_profile and exported the PATH to both files in there as such:

export PATH=$PATH:/Users/<personal name>/geckodriver-0.30.0

export PATH=$PATH:/Users/<personal name>/chromedriver

After running the terminal command, echo $PATH, the following returns:

/Users/<personal name>/.nvm/versions/node/v16.11.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/<personal name>/.nvm/versions/node/v16.11.0/bin:/Users/andrewrea/geckodriver-0.30.0:/Users/<personal name>/chromedriver:/Users/<personal name>/geckodriver-0.30.0:/Users/<personal name>/chromedriver

And the browser which should open is not opening.

Any help would be appreciated.

go the gecko i notice there a note on the download page saying that

  • macOS 10.15 (Catalina) and later: Due to the requirement from Apple that all programs must be
    notarized, geckodriver will not work on Catalina if you manually
    download it through another notarized program, such as Firefox.Whilst we are working on a repackaging fix for this problem, you can
    find more details on how to work around this issue in the macOS
    notarization
    section of the documentation.

not sure if that has effect or not

did you make that

  • Create a new file inside your project directory called google_test.js :
  • Give it the following contents, then save it:

and have a nice day :slight_smile:

1 Like

Cool that you answered, @justsomeone. I have no idea about this topic and was hoping for you to chime in :wink: :grin:

2 Likes

i did not answered i just kept pushing randomly on my keyboard look what we get :joy:

i read it long ago but i did not dig too deep into it you can say i just learn the possibility and not the how to so when i need it i would know where to look at :slight_smile:

thanks a lot boss :wink: for you encourage and nice words :slight_smile:

1 Like

i forgot to mention that there arm and intel based driver so if you use the new m1 chip you should use the arm

what inside this folder is it the driver or there another folder inside it that has the driver

Thank you very much, @justsomeone!

I’m out and about right now but when I get home, I will definitely look up that documentation about the requirement for macOS 10.15 (Catalina) and later for downloading the geckodriver.

Thank you!

@justsomeone, here is a screenshot of my Users/<personal name> folder. Should my PATH be changed to Users/<personal name>/geckodriver-0.30.0/<additional PATH info>? (Which will probably change once I download it again using the notarized program per the information you provided above.)

you very welcome

if geckodriver-0.30.0 has the driver inside it then you fine but if it has another folder and this second folder is the one that thas the driver then you would update the path to be the internal folder

is that the chromedriver ? if yes then the path would be /user/your username

so in short way the path you add is the folder that has the driver starting from the root

i do not have mac so i do not know much more about that i just trying to fix if there issue when you set the PATH

some notice about the export it effect will be immediate and till you close that current session (close the terminal in most cases) but setting it on the .bash file will stay there but you would need to reload the session so simply close the terminal and open it would do the trick

let me know how it work

Hey guys! @justsomeone @Andrew_Rea @mikoMK

Tagging you guys back here because I’m on this section with similar issues.

After going through the instructions on setting up my web drivers here: https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment

then running:
node google_test

My terminal gives this error:

SessionNotCreatedError: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line

As instructed, I have my driver here in the path usr/local/bin

My .bash_profile contains the path as instructed

The google_test.js file is written like so

I’m using a Macbook Pro M1 Chip with Ventura OS 13.3.1

Am I doing something wrong?

Hello @Vladlen_Vronsky

sorry for late replay for some reason i did not get an email notification and it was notification from another post that bring me the forum and saw that one

there many thing that cause this :

  1. check those stackoverflow https://stackoverflow.com/a/66000618 https://stackoverflow.com/a/65322308

  2. if the above is not the cause that then maybe that js file need to be updated as notice from the link of the tutorial then mention selenium version 3 while currently it version 4.9 and in another post (not about that tutorial but about some other automated stuff) those version difference lead to bugs

  3. to make sure it’s about firefox location you can use different browser like safari or chrome
    check this guide
    https://www.selenium.dev/documentation/webdriver/getting_started/first_script/

sorry i do not use selenium to better help to debug that

Edit :

this the other browser option you can use for the forBrowser method on your js

https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_Builder.html

the following are enum value instead of the string that
https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/lib/capabilities_exports_Browser.html

hope that help to find the cause of the issue and have a nice day :slight_smile: