0

Below is the content of a drop down. I want to click on export csv.

what is the css path for export csv so that i can click on it through selenium web driver.

Select class is not applicable since no select is present in the HTML.

enter image description here

can you write the css path to select export csv

panchanan
  • 170
  • 1
  • 3
  • 11

1 Answers1

1

You can take help from id on building css selector. To build css by id then need to use #

 li#ui-menu-item-exportcsv

Thank You, Murali

murali selenium
  • 3,847
  • 2
  • 11
  • 20
  • You can try using title also li[title='write that title here'] – murali selenium Apr 19 '16 at 09:38
  • Thank you. what will be the css for ul tag in above html. is it ul#ui-menu-widget-content . if i want to write with the help of class, what will be the css path. – panchanan Apr 19 '16 at 09:59
  • Hi, if you want to create css by using class then use '.' example: ul.ui-menu-content.ui-widget-content if observe in this example i used '.' twice because in class we have space nothing but compound class so we need to replace spaces in class by '.' – murali selenium Apr 19 '16 at 10:23
  • Thanks. one more question if i have repeated html blocks(as above) with same div and ul tag ,but li tags are different, how do we write the css path for last html block (means li element / ul elements/class). above html block will be the last block. – panchanan Apr 19 '16 at 10:47
  • Hi, we need to figure it out required element only by taking help of any one of unique attribute. in provided answer id is unique of required li so we written like that. if it not possible then we need to find css of parent of li then need to navigate to child by using ">". if you want to specify second li of ul then u can say like ul>li+li or nth-child. see this http://stackoverflow.com/questions/9682521/how-do-i-get-the-nth-child-of-an-element-using-css2-selectors – murali selenium Apr 19 '16 at 10:57