rp123409
rp123409

Reputation: 11

Selenium beginner question

I am just trying to understand and learn selenium. I used IDE to record my actions and tried to playback but I am kind of stuck on the first step.

What I am trying is basically login to our internal site and then click on menu bar to navigate to an internal page. Selenium logs in but fails at the click event with error message -

[error] Element css=#ui-active-menuitem > span.wijmo-wijmenu-text > span.wijmo-wijmenu-text not found

This site is generated using primeface and when I see the source code, the line that generate error is something like-

<div align="left" class="container"><div id="menu"><ul id="menu_menu"><li><a href="javascript:void(0)">
<span class="wijmo-wijmenu-text">Home</span></a><ul><li><a href="home">home</a></li></ul>
 </li><li><a href="javascript:void(0)"><span class="wijmo-wijmenu-text">Tills</span></a><ul>
 <li><a href="tills">Manage</a>........

I must tell here that as long as I am not clicking on above menu item, I am able to run all tests through Selenium ID but clicking on above menu after login is essential to get to inner pages.

You help/guidance is much appreciated.

Thanks

Upvotes: 1

Views: 1921

Answers (4)

Athmeeya Gowda
Athmeeya Gowda

Reputation: 16

Add wait and never try learning selenium through IDE . disadvantages of using IDE is you cannot add conditions ,loops and wait in your code and cannot maintain the framework.

Upvotes: 0

Rupam Routh
Rupam Routh

Reputation: 1

I think before appearing the menu Selenium trying to click. Just use

Thread.sleep(5000); // for five second waiting or more you can use

Another way use -

WebDriverWait wait = new WebDriverWait (driver, 30); // maximum wait 30     seconds
wait.until(ExpectedConitions.PresenceofElement(By.id("Menu_id"))).click();

Upvotes: 0

Ann
Ann

Reputation: 129

Maybe element not found just because it not loaded yet.After log in you can try to use command waitForElementPresent and then click on element. It seems you refer to an element by css, you can try id or name

Upvotes: 1

picanha
picanha

Reputation: 11

I'm begining too and having same problem. This commands work for me:

clik link=menuName

clickAndWait link=subMenuName

Hope it helps.

Upvotes: 1

Related Questions