I want to find specific web element by executing javascript code and then click on that element. This is my code:
driver.get('https://justjoin.it')
driver.maximize_window()
for position in [x.text for x in driver.find_elements_by_xpath('//div[@class="css-1x9zltl"]')]:
javascript = f"document.evaluate('//div[contains(@class, 'css-1x9zltl') and text()='{position}']', document);"
driver.execute_script(javascript).click()
And when I run this code console throws me this error:
selenium.common.exceptions.JavascriptException: Message: javascript error: missing ) after argument list
Any ideas how to solve this?