0

I am writing a web bot using selenium in Python. I tried to find elements by css selector, however the html for some elements has no id and has only class name. Some of these have two words as the class name. If it was one word, I could've written .oneword, but it has two words. I actually don't know anything about css or js. I am using this syntax

var=bot.find_element_by_css_selector('css-selector')
  • 2
    Does this answer your question? [CSS Selector that applies to elements with two classes](https://stackoverflow.com/questions/3772290/css-selector-that-applies-to-elements-with-two-classes) – CertainPerformance Jan 22 '20 at 05:33

2 Answers2

0

Try accessing the element using xpath

bot.find_element_by_xpath("//div[@class='value test']")

Refer this: https://selenium-python.readthedocs.io/locating-elements.html#locating-by-xpath

Mohd Sheeraz
  • 315
  • 1
  • 3
  • 11
0

Replace the space between two words by .(dot)

For Example then by_css_selector('test1.test2)