0

We have successfully login into the application via Selenium, but we can´t go anywhere from there.

Selenium just stop working from that point on.

This is the code that we are using to get into the application:

public class testclass {

public static void main(String[] args) {
    System.setProperty("webdriver.gecko.driver", "C:\\Selenium-java-3.0.1\\geckodriver.exe");
    ProfilesIni profile = new ProfilesIni();
       // this will create an object for the Firefox profile
    FirefoxProfile myprofile = profile.getProfile("default");
       // this will Initialize the Firefox driver
    WebDriver driver = new FirefoxDriver(myprofile);
     driver.get("https://applicationURL/Forms");
     driver.findElement(By.xpath(".//*[@id='login']")).click();
     driver.findElement(By.xpath(".//*[@id='login']")).sendKeys("username");
     driver.findElement(By.xpath(".//*[@id='password']")).click();
     driver.findElement(By.xpath(".//*[@id='password']")).sendKeys("password");
     driver.findElement(By.xpath(".//*[@id='btnlogin']")).click();

[this is where Selenium just stops]

     driver.findElement(By.xpath(".//*[@id='panelBarMiddleSearchPanels_i0_txtAttr_1_22']")).click();
     driver.findElement(By.xpath(".//*[@id='panelBarMiddleSearchPanels_i0_txtAttr_1_22']")).sendKeys("LTR*");

}

}

Then I don`t know where to find the error that Selenium is getting ? Because it just stops at the point where it needs to go further.

I am not sure if it is important to mention, but we are working via VPN. I am not sure if it is related to this issue -- Can't open browser with Selenium after Firefox update

FortuneSoldier
  • 502
  • 3
  • 21
  • Can you post a stack trace of the error you are getting? is it possible that the element is not loaded yet? can you add in a wait for the page to load after the login – Thomas Jun 09 '17 at 09:53
  • @NebojsaKomnenovic IMHO, you should immediately stop loading the `default` profile and start your Automation work with a new Profile created either afresh manually or created on the fly. With the default profile you seem to be lucky getting till that point :) Thanks – undetected Selenium Jun 09 '17 at 10:05

1 Answers1

1

Try to use following updated code :

   public class testclass {

public static void main(String[] args) throws Exception{
    System.setProperty("webdriver.gecko.driver", "C:\\Selenium-java-3.0.1\\geckodriver.exe");
    ProfilesIni profile = new ProfilesIni();
       // this will create an object for the Firefox profile
    FirefoxProfile myprofile = profile.getProfile("default");
       // this will Initialize the Firefox driver
    WebDriver driver = new FirefoxDriver(myprofile);
     driver.get("https://applicationURL/Forms");
     driver.findElement(By.xpath(".//*[@id='login']")).click();
     driver.findElement(By.xpath(".//*[@id='login']")).sendKeys("username");
     driver.findElement(By.xpath(".//*[@id='password']")).click();
     driver.findElement(By.xpath(".//*[@id='password']")).sendKeys("password");
     driver.findElement(By.xpath(".//*[@id='btnlogin']")).click();
     Thread.sleep(7000);
driver.findElement(By.xpath(".//*[@id='panelBarMiddleSearchPanels_i0_txtAttr_1_22']")).click();
     driver.findElement(By.xpath(".//*[@id='panelBarMiddleSearchPanels_i0_txtAttr_1_22']")).sendKeys("LTR*");

}

Hope it will help you.

RNS
  • 625
  • 5
  • 16