html - Need equivalent CSS Selectors of an XPATH expression -
i have html code below :
<div id="select_a_boundary" class="dataset_select2">homes name</div>
i wrote xpath expression same:
//div[@id = 'select_a_boundary' , @class = 'dataset_select2']
what equivalent css selectors same?
first of if using id
, don't require use class, secondly if willing yo select element id select_a_boundary
can use
#select_a_boundary { /* styles goes here */ }
note: not selecting element has id , class here, id sufficient has unique, if using id multiple elements it's invalid
as per comment
div[id=select_a_boundary][class=dataset_select2] { color: red; }
or easier 1 (credits: jack)
#select_a_boundary.dataset_select2 { color: red; }
note: still recommend use
#select_a_boundary
more enough
Comments
Post a Comment