Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
vidya shree
Regular Participant
Regular Participant
Posts : 31
Join date : 2013-05-09

Problems in locating elements in Selenium Empty Problems in locating elements in Selenium

Thu May 09, 2013 4:45 pm
Hi!! I m new to Selenium. i am using Selenium 2.0 (java).I am facing problms in locating the elements.

For example:

I tried to locate "Logout" in the mail by id,Xpath and CSS.But none of this located properly.

Even i checked using Firefinder to highlight that Element(Logout) by Xpath and CSS.But i cudnt find it.

Please help me to clear out the issue.

[ Does selenium has any Object Repository as in QTP ??..

Selenium looks difficult in locating objects when compare to QTP.Is it so?

Which is the best tool for Automation Testing??Question ]

Looking forward ur kindness.

Thanks,

Vidya.
avatar
tarun3kumar
Master
Master
Posts : 186
Join date : 2012-02-14
http://seleniumtests.com

Problems in locating elements in Selenium Empty Re: Problems in locating elements in Selenium

Thu May 09, 2013 5:23 pm
Selenium does not have object repo like QTP, but nothing stops you to build one. About Logout link, would you show us html of link and locator you used?
avatar
vidya shree
Regular Participant
Regular Participant
Posts : 31
Join date : 2013-05-09

Problems in locating elements in Selenium Empty Re: Problems in locating elements in Selenium

Thu May 09, 2013 5:48 pm
Thanks for ur response

Following is the HTML for t same.

"id="e-toptoolbar-pref" class="s-top-text" onclick="AAA.DSq.ELU(event, this.id, 'EPH');return false;" style="font-weight: bold;" href="#">Logout"

Note: I ve removed the anchor tag in the above code.

For tat i ve used xpath as "//*[@id="e-toptoolbar-pref"]" and "//html/body/div/div/div[6]/div/table/tbody/tr/td[7]/a"
and CSS as "html body.s-basicpanel div.s-stack div.s-basicpanel div.s-toppanel div#e-mainmenu-area.s-mainmenu-area table.s-top-text tbody tr td a#e-toptoolbar-pref.s-top-text"

Awaiting ur response

Thanks
Vidya
vinayakjadhav1857
vinayakjadhav1857
Active particpant
Active particpant
Posts : 19
Join date : 2013-04-22

Problems in locating elements in Selenium Empty Re: Problems in locating elements in Selenium

Thu May 09, 2013 6:42 pm
will u show the whole html code or the relative div ?
avatar
vidya shree
Regular Participant
Regular Participant
Posts : 31
Join date : 2013-05-09

Problems in locating elements in Selenium Empty Re: Problems in locating elements in Selenium

Thu May 09, 2013 8:32 pm
Thanks for ur response vinayak

I am not able to attach my code here.
Any suggestions to display the code ??

Thanks,
Vidya.
vinayakjadhav1857
vinayakjadhav1857
Active particpant
Active particpant
Posts : 19
Join date : 2013-04-22

Problems in locating elements in Selenium Empty Re: Problems in locating elements in Selenium

Fri May 10, 2013 11:23 am
ok.. just check in which frame ""e-toptoolbar-pref" " is located in your plain HTML code..switch to that frame..and then select the respective element..

driver.switchTo().frame("yourframename");
avatar
vidya shree
Regular Participant
Regular Participant
Posts : 31
Join date : 2013-05-09

Problems in locating elements in Selenium Empty Re: Problems in locating elements in Selenium

Fri May 10, 2013 12:29 pm
Thanks for ur response vinayak

Ya Its working now.
Now i am able to locate the logout link.
Here is my code:
driver.switchTo().frame(driver.findElement(By.name("s_MainFrame")));
WebElement logout = driver.findElement(By.xpath("//html/body/div/div/div[6]/div/table/tbody/tr/td[7]/a"));
logout.click();
driver.switchTo().defaultContent();

Thanks again.
Vidya.
vinayakjadhav1857
vinayakjadhav1857
Active particpant
Active particpant
Posts : 19
Join date : 2013-04-22

Problems in locating elements in Selenium Empty Re: Problems in locating elements in Selenium

Fri May 10, 2013 1:01 pm
nice to hear..
Sponsored content

Problems in locating elements in Selenium Empty Re: Problems in locating elements in Selenium

Back to top
Permissions in this forum:
You cannot reply to topics in this forum