Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce

» Selecting the input for auto populating element
Sat Jul 29, 2017 7:53 pm by kdabbara

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
avatar
Joffre

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

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)
avatar
Joffre

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

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
avatar
Joffre

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

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.
avatar
Joffre

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

Back to top Go down

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

Post by Sponsored content


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