Selenium python find_element_by_class_name() stopped working from v 2.2 to 2.21 — cannot use 'Compound Class Name'

后端 未结 4 923
轻奢々
轻奢々 2020-12-09 12:00

I am using Selenium\'s python library to scrape data from a html page in Firefox.

I have had to update from Selenium 2.0 to 2.21 because the server has updated Firef

4条回答
  •  一整个雨季
    2020-12-09 12:41

    The problem about WebDriver is that it still evolves. A lot. I personally don't know about a version that supported searching by many classes in one command, so it must have been a fairly old one :).

    Searching by a CSS selector should work, however:

    find_element_by_css_selector(".grid-cell-inner.grid-col-name");
    

    I don't recommend using XPath for this particular thing, because these two following expressions are a different thing:

    //*[class='grid-cell-inner grid-col-name']

    //*[class='grid-col-name grid-cell-inner']

提交回复
热议问题