this post was submitted on 11 Jul 2023
19 points (88.0% liked)

Technology

59299 readers
6829 users here now

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related content.
  3. Be excellent to each another!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, to ask if your bot can be added please contact us.
  9. Check for duplicates before posting, duplicates may be removed

Approved Bots


founded 1 year ago
MODERATORS
 

Beginner learning Selenium WebDriver and here is my first attempt (in the pastebin link): https://pastebin.com/TC718eKi

OS: Ubuntu 23.04

IDE: intelliJ

Browser: FireFox

Dependencies: Selenium-Java (4.10.0)/ Selenium-API (4.10.0)/ TestNG (7.8.0)/ webdrivermanager (5.4.0)

But test failed with the following Error Message:

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: 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

top 10 comments
sorted by: hot top controversial new old
[–] [email protected] 3 points 1 year ago* (last edited 1 year ago) (1 children)

Hi, I'm not that familiar in selenium in both java and ubuntu. Have you tried installing firefox using apt instead since I believe this is caused by your firefox being installed either via flatpak or snaps.

[–] [email protected] 1 points 1 year ago

Firefox browser is the default browser that came with the ubuntu os. Been updating the version using snap though. A lot of the beginner material is suggesting to use chromedriver, I will eventually learn through that route, I'm just a bit stubborn when it comes to using the "not-so private" browser. Thanks for your response.

[–] [email protected] 2 points 1 year ago (1 children)

It's probably because Firefox is default as a snap package on Ubuntu. I fixed mine by creating a symlink to the snap geckodriver to a directory in my $PATH. So for example:

ln -s /snap/bin/firefox.geckodriver ~/.local/bin

[–] [email protected] 1 points 1 year ago

Thank you for responding. I tried creating a symlink, but, unfortunately, still face the same error.

[–] [email protected] 2 points 1 year ago (1 children)

You need to install the Firefox-driver. That’s what selenium uses to control the browser. You either download it or get it from Apt.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

Is there more to the process? I downloaded firefox from both the webpage and through CLI and have them both moved to the ~/.local/bin directory(PATH) but still the error message appears to fail the test

[–] [email protected] 1 points 1 year ago

There shouldn’t be.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

If selenium is causing you too much trouble, there is also https://pptr.dev/

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (1 children)

It's not a solution to your problem, but have you tried playwright instead of selenium? For me playwright is great, it works with .NET, Java, Python, JS and TS

[–] [email protected] 1 points 1 year ago

I actually am highly interested in jumping on the Playwright bandwagon; been hearing about it for a while and am looking to get into it soon. I just want to take the humble route of learning the more common tool first since it is still widely recognized as one of the basic requirement for test automation positions. Plus I want to comprehend the challenges at the beginning of the journey to eventually have an easier time working with the simpler tools later on.

load more comments
view more: next ›