Selenium Webdriver w/Java: locating elements with multiple class names with one command

后端 未结 1 977
谎友^
谎友^ 2020-12-11 03:10

I\'m trying to use Selenium (2.31.0, using JavaSE 1.6 and IE9) to find a series of elements on a page. These elements all have one of two class names, \'dataLabel\' or \'dat

相关标签:
1条回答
  • 2020-12-11 04:08

    Why wouldn't you do the following:

    driver.findElement(By.cssSelector(".dataLabel,.dataLabelWide");
    

    The '.' selector says, "give me all elements with this class." The ',' operator is the CSS selector 'or' operator.

    0 讨论(0)
提交回复
热议问题