0

My code initially goes to this page http://test1.absofttrainings.com, that is the url i have in my get(url) option. After going to this page on top there is TestPages which has an option Java Script, Alert,Confirm, Popup boxes.

Problem: I am trying to click that selection Java script from this page http://test1.absofttrainings.com and go to the Java script, Alert page.I am getting No such element error.

I tried waituntil visible, implicit wait nothing worked.

browserFunction("firefox", "http://test1.absofttrainings.com");

    driver.manage().timeouts().implicitlyWait( 15, TimeUnit.SECONDS );

    driver.findElement(By.linkText("JavaScript Alert,Confirm,Prompt Boxes")).click();
    driver.manage().timeouts().implicitlyWait( 15, TimeUnit.SECONDS );
    //wait.until(ExpectedConditions.titleContains("JavaScript Alert,Confirm,Prompt Boxes"));

Thanks in advance for your time.

2
  • To click on target link you should hover over TestPages element first. Show code you use to hover Commented Nov 26, 2016 at 17:44
  • 1
    Great I was not aware of that hover function, after doing some research I found about using Action, hopefully that will do the trick. Commented Nov 26, 2016 at 22:00

1 Answer 1

1

You just need to hover the menu first, then the link you want will be exposed and you can click on it.

driver.get("http://test1.absofttrainings.com/");
new Actions(driver).moveToElement(driver.findElement(By.linkText("Test Pages"))).build().perform();
driver.findElement(By.linkText("JavaScript Alert,Confirm,Prompt Boxes")).click();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.