<div id=“idname” class=“class”></div>
<div id=“idname” class=“class”></div>
.
.
.
<div id=“idname” class=“class”></div>
<div id=“idname” class=“class test”></div>
<div id=“idname” class=“class”></div>
I have this code. There are countless divs, and only one of them has class ="class test".
How to set class name in selenium?
CodePudding user response:
In case you are asking how to select web element based on class test
class value - it can be done with XPath like this:
//div[@class='class test']
or CSS Selector like this
div.class.test
CodePudding user response:
if you are trying to select an element with class class test
you can do it with XPath
element = driver.find_element_by_xpath("//div[@class='class test']")