- Joffre
- Posts : 5
Join date : 2013-06-03
Age : 35
How to map an element? | Como mapear um elemento?
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
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
Re: How to map an element? | Como mapear um elemento?
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.
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.
- Joffre
- Posts : 5
Join date : 2013-06-03
Age : 35
Re: How to map an element? | Como mapear um elemento?
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!
Any more ideas?! =x
Thank you!
Re: How to map an element? | Como mapear um elemento?
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.
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.
- Joffre
- Posts : 5
Join date : 2013-06-03
Age : 35
Re: How to map an element? | Como mapear um elemento?
Wed Jun 05, 2013 8:33 pm
I've tried like below, is it correct?
This is such a nightmare...!
- Code:
ieDriver.get(linkFPWeb);
ieDriver.findElement(By.xpath("//div[@class='menu-bar']/span[@class=menu-button][4]/span[@class='middle']")).click();
- Code:
org.openqa.selenium.NoSuchElementException: Unable to find element with xpath == //div[@class='menu-bar']/span[@class=menu-button][4]/span[@class='middle']
This is such a nightmare...!
Re: How to map an element? | Como mapear um elemento?
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
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
- Joffre
- Posts : 5
Join date : 2013-06-03
Age : 35
Re: How to map an element? | Como mapear um elemento?
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.
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.
Permissions in this forum:
You cannot reply to topics in this forum
|
|