Error when using the click option


I have the following script:

package automationFramework;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class FirstTestCase {

public static void main(String[] args) throws InterruptedException {
// Create a new instance of the Firefox driver
System.setProperty(“webdriver.gecko.driver”, “/home/gradulescu/Documents/Eclipse project/geckodriver.exe”);
WebDriver driver = new FirefoxDriver();

// Storing the Application Url in the String variable
String url = “”;

//Launch the Online Store Website

Thread.sleep (120);


What I want to do is to click the register button and then go back.

When I use the register command without the back, then it goes to register page and it stays there.

If I use the register command with the back command, it doesn’t goes to register page any more, or at least I cannot see, although I have put a 2 mins time out so that I could see.


Also, an error is generated in the console:

line 515: ReferenceError: accordion is not defined
JavaScript warning:, line 68: unreachable code after return statement


Could you help me with this?

Thank you!


Add Comment
  • 1 Answer(s)

    Your code is correct just change thread sleep time from 120 milliseconds to 5000 milliseconds = 5 seconds so you will notice the actual page transitions.

    Your assumption that sleep parameter is in seconds is incorrect. It actually takes a value milliseconds.

    Default Answered on June 26, 2018.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.