7Gabriel / selenium-vba

Automatically exported from code.google.com/p/selenium-vba
0 stars 0 forks source link

Look for a string inside multiple elements #165

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Operating system : Windows 7
.Net Framework version :
Office Version : 2010
SeleniumWrapper version : 1.0.17.0

What is your issue ?

Hi i am able to understand VBA easily, but im new to css and xpath. I have been 
trying to list or get a simple value from an html code with the get attribute 
option. But i have not been able to search for the simple text since there are 
multiple items in a "shelf".

I just want to validate that the data is inside the shelf,

this is the HTML code for the website im in. and the string im trying to get is 
to check is "DL-18"

"<See attached File>"

i have tried with multiple lines but none seem to be working

PartNumber = "DL-18"

Debug.Print Verify.Equals("DL-18", 
'driver.findElementByCssSelector(".item_details > ul > li > em > span > 
PartNumber").Text)

'PartNumber = driver.findElementByCssSelector("#item_details > ul > li > em > 
span").Text

i need to run this for multiple items, thats why im setting de PN as a variable 
(just a test variable as string).

Thanks in advance, any help is welcomed.

Original issue reported on code.google.com by tutz260...@gmail.com on 15 Jul 2015 at 6:37

Attachments:

GoogleCodeExporter commented 8 years ago
> driver.findElementByCssSelector(".item_details > ul > li > em > span > 
PartNumber").Text
The html tag PartNumber doesn't exists

> driver.findElementByCssSelector("#item_details > ul > li > em > span").Text
The id #item_details doesn't exists

A correct CSS selector would be:
driver.findElementByCssSelector(".shelfItem .shelfItemDetails em>span").Text

Original comment by florentbr on 21 Jul 2015 at 6:26