What is the difference between Name and Class locators in selenium? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

What is the difference between Name and Class locators in selenium?

Difference between driver.findElement(By.class) and driver.findElement(By.Name)?

21st Apr 2019, 11:34 AM
paperinflames
paperinflames - avatar
1 ответ
+ 3
Name and Class are different attributes of an element. Say I have an element <button name=“myButton” class=“test myClass” ... /> I can then use By.className(“test”) or By.Name(“myButton”) in the findElement() method to find this button Have a look at the html at work you’re writing your selenium classes for and see what attributes you can find elements by 👍🏾
21st Apr 2019, 4:15 PM
Jenine