How to select HTML element by XPATH if attribute name contains space?

Viewed 30

for example

<li big class="attribute"></li> 

in selenium selecting would be like this

driver.find_element(By.XPATH, '//*[@big class="attribute"]');

so how can i select the element by XPATH , using that results an invalid expression.
selecting just by class like this //*[@class="attribute"] doesnt work

1 Answers

If you want to select element by both attributes correct code would be

driver.find_element(By.XPATH, '//li[@big and @class="attribute"]')

note that big seem to be a separate boolean attribute (it might not have an explicit value) but not an "... attribute name contains space"

Related