I have the following code in selenium but continue to get a syntax error. I\'m trying to select an element based on multiple conditions.
choices = driver.fin
As per the xpath you have shared as follows :
choices = driver.find_elements_by_xpath("//div[contains(.,'5') and [contains(@class, 'option')]]")$
You need to consider a few facts :
<div>
tag can't be within nested []
. Either you have to specify within one []
or within multiple []
s.$
You can rewrite the xpath
in either of the following ways :
choices = driver.find_elements_by_xpath("//div[contains(.,'5') and contains(@class, 'option')]")
# or
choices = driver.find_elements_by_xpath("//div[contains(.,'5')][contains(@class, 'option')]")