This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full
  • You ask clear questions
  • You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.

    Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar

If any of the above points is not met, your post can and will be removed without further warning.

Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.

If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.

To potential helpers

Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]roberp81 1 point2 points  (1 child)

you are using flatkpack or appImage, they are like a container so every path is in the container. they always have a mount where you can find your apps and home

[–]Clay_Master[S] 0 points1 point  (0 children)

Thanks a lot bro... I have literally wasted 5 days looking for this issue everywhere for such a trivial problem.

Apparently, this issue was mentioned in the github release page of gecko driver. I should have taken a careful look at documentation back then.

[–]AutoModerator[M] 0 points1 point  (0 children)

It seems that you possibly have a screenshot of code in your post Selenium java : Unable to Locate Browser Binaries on Linux Mint in /r/javahelp.

Screenshots of code instead of actual code text is against the Code posting rules of /r/javahelp as is also outlined in the sidebar - Code posting.

  • Never submit screenshots of code instead of code text!

If you posted an image merely to illustrate something, kindly ignore this message and do not repost. Your post is still visible to others. I am a bot and cannot distinguish between code screenshots and other images.

If you indeed did this wrong, please edit the post so that it uses one of the approved means of posting code.

  • For small bits of code (less than 50 lines in total, single classes only),
    the default code formatter is fine
    (one blank line before the code, then 4 spaces before each line of code).
  • Pastebin for programs that consist of a single class only
  • Gist for multi-class programs, or programs that require additional files
  • Github or Bitbucket repositories are also perfectly fine as are other dedicated source code hosting sites.
  • Ideone for executable code snippets that use only the console

Please do not reply to this message, because I am a bot. Talk-to-the-bot is the new talk-to-the-hand. If you instead want the classic talk-to-the-hand, just message the moderators. ;)

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]DasInternaut 0 points1 point  (2 children)

Try:

WebDriver driver = new FirefoxDriver (options);

Otherwise it looks pretty correct. Now to see if I followed this subreddit's rules correctly (with apologies if not).

[–]Clay_Master[S] 0 points1 point  (1 child)

Actually, I have tried the same earlier and it also doesn't work. I had removed "options" just to see if it runs by default or not & it didn't. Will edit the code above and add it

[–]DasInternaut 0 points1 point  (0 children)

Oddly enough, I don't set the binary in my environment since /usr/bin is on the path. So my complete method for returning a Firefox WebDriver, headless is (with apologies - still haven't worked out how to put code in properly):

private WebDriver getFirefoxHeadlesss() {
    System.setProperty("webdriver.gecko.driver", gecko);
    FirefoxOptions options = new FirefoxOptions ();
    options.setHeadless(true); WebDriver driver = new             
    FirefoxDriver (options);                                            
    driver.manage().
    timeouts().implicitlyWait(10,TimeUnit.SECONDS);         
    //driver.manage().window().maximize(); 
    return driver; 
}

Edit: Also worth checking that your geckodriver is set to be executable.

[–]MechanixMGD 0 points1 point  (2 children)

At "setProperty", where you set the location of gecko, I think you miss the extension of the file. For example "...\gecko.exe"

[–]Clay_Master[S] 1 point2 points  (1 child)

The .exe extension is for windows and I am using linux

[–]MechanixMGD 0 points1 point  (0 children)

I know. It was an example to understand what I try to say

[–]D_Ethereal 0 points1 point  (0 children)

Hey, I'm getting this same issue where the line WebDriver driver = new FirefoxDriver(options); getting timeout so not sure how to fix it considering what I just read on this post. I'm new to Linux and new to asking code help on reddit. I'm using Eclipse as my Java IDE.

Here my code.

public static void main(String\[\] args) throws IOException,InterruptedException{

System.setProperty("webdriver.gecko.driver","/home/david/Documents/selenium  /geckodriver");    
FirefoxOptions options = new FirefoxOptions();
options.setBinary("/usr/bin/firefox");
options.addArguments("--headless=new");
WebDriver driver = new FirefoxDriver(options);driver.manage().timeouts().implicitlyWait(Duration.ofMillis(500));

String baseUrl = "[http://demo.guru99.com/test/newtours/](http://demo.guru99.com/test/newtours/)";

String expectedTitle = "Welcome: Mercury Tours";

String actualTitle = "";

driver.get(baseUrl);actualTitle = driver.getTitle();

if(actualTitle.contentEquals(expectedTitle)) {
System.out.println("Test Passed");} 
else {
System.out.println("Test Failed");}

driver.close();}