Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx

» Selenium IDE Verify different Maps (Hybridview, Mapview etc.)
Fri Nov 25, 2016 9:56 pm by DJ87

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

How to map an element? | Como mapear um elemento?

View previous topic View next topic Go down

How to map an element? | Como mapear um elemento?

Post by Joffre on Mon Jun 03, 2013 8:52 pm

Hi all.

How can I map the menu (menu.jpg)? I'm using selenium-server-standalone-2.33.0, on a Java app.

I've tried using the easier way, using the function findElement(By.id()) but it didn't work. I think I'll have to use XPath, but I have no idea how to do that.

I've attached the HTML script either (html.jpg). Any ideas?

Thank you!

-----

Olá a todos.

Como posso mapear o menu em anexo (menu.jpg)? Estou usando selenium-server-standalone-2.33.0, em uma aplicação Java.

Tentei usar da forma mais fácil, usando a função findElement(By.id()) mas não funcionou. Creio que precisarei usar XPath, mas não tenho idéia de como fazê-lo.

Anexei o script HTML da página também (html.jpg). Alguma ideia?

Obrigado!

-----

Images:


menu.jpg


html.jpg

Joffre

Posts : 5
Join date : 2013-06-03
Age : 28

Back to top Go down

Re: How to map an element? | Como mapear um elemento?

Post by tarun3kumar on Tue Jun 04, 2013 10:51 am

You could try this to find element -

WebElement element = driver.findElement(By.className("middle"));

and then perform operation on "element" like - click etc.

Notice that I am using class to identify element here.
The order of element identification would usually be -

id>name>css selector > xPath

Hence xPath should be last resort to identify an element.

_________________
Thanks
Tarun K
Free Selenium Training

tarun3kumar
Master
Master

Posts : 186
Join date : 2012-02-14

http://seleniumtests.com

Back to top Go down

Re: How to map an element? | Como mapear um elemento?

Post by Joffre on Tue Jun 04, 2013 5:55 pm

Hello tarun3kumar, thanx for your answer. However, the 'class='middle' isn't unique as you can see on the image below.



Any more ideas?! =x

Thank you!


Last edited by Joffre on Tue Jun 04, 2013 5:55 pm; edited 1 time in total (Reason for editing : arranging the text)

Joffre

Posts : 5
Join date : 2013-06-03
Age : 28

Back to top Go down

Re: How to map an element? | Como mapear um elemento?

Post by tarun3kumar on Wed Jun 05, 2013 1:15 pm

hm, In that case we can navigate from parent node.
Seems class "menu-bar" is constant hence you can try this -

//div[@class='menu-bar']/span[@class=menu-button][4]/span[@class='middle']

that is - get the fourth span of parent div and then get the span with class 'middle'.
Let me know if this helps.

_________________
Thanks
Tarun K
Free Selenium Training

tarun3kumar
Master
Master

Posts : 186
Join date : 2012-02-14

http://seleniumtests.com

Back to top Go down

Re: How to map an element? | Como mapear um elemento?

Post by Joffre on Wed Jun 05, 2013 8:33 pm

I've tried like below, is it correct?

Code:
ieDriver.get(linkFPWeb);
ieDriver.findElement(By.xpath("//div[@class='menu-bar']/span[@class=menu-button][4]/span[@class='middle']")).click();
But it didn't work, as the log says below:

Code:
org.openqa.selenium.NoSuchElementException: Unable to find element with xpath == //div[@class='menu-bar']/span[@class=menu-button][4]/span[@class='middle']
I've forgot to show, after I click the menu, I'll have to click on the sub-menu item.



This is such a nightmare...!

Sad

Joffre

Posts : 5
Join date : 2013-06-03
Age : 28

Back to top Go down

Re: How to map an element? | Como mapear um elemento?

Post by tarun3kumar on Thu Jun 06, 2013 10:16 am

If I am not mistaken then you want to click on - "Ocorrencias"
Is there a way for me to access your application?
if you can not post application detail publicly then contact me on skype id -

tarun3kumar


_________________
Thanks
Tarun K
Free Selenium Training

tarun3kumar
Master
Master

Posts : 186
Join date : 2012-02-14

http://seleniumtests.com

Back to top Go down

Re: How to map an element? | Como mapear um elemento?

Post by Joffre on Thu Jun 06, 2013 6:03 pm

I hardly think so, 'cause the application isn't mine - it is from the company I work for.

I'll try some other things here. If it doesn't work, I'll come back and try this skype option.

Thank you very much for your help so far.

Joffre

Posts : 5
Join date : 2013-06-03
Age : 28

Back to top Go down

Re: How to map an element? | Como mapear um elemento?

Post by Sponsored content Today at 10:59 am


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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