I'm trying to web scrape this site https://www.parts-catalogs.com/us/demo/#/groups?catalogId=vw&carId=fccabcf290dc6cfdd3d401531d4ad6a8&q=WVWMA83BXWE446629&criteria=10%2aWVWMA83BXWE446629%2131a3cee7 , but I'm having a problem. The site has JavaScript Bubbling Event.
I tried to select my element and use the bubbling event function as JavaScript code, but I get this error: " JavascriptException: Message: SyntaxError: function statement requires a name ".
If anyone has any solution or some code that can help me, I would be grateful!
here is the code:
# 1
driver.get('https://www.parts-catalogs.com/us/demo/#/groups?catalogId=vw&carId=fccabcf290dc6cfdd3d401531d4ad6a8&q=WVWMA83BXWE446629&criteria=10%2aWVWMA83BXWE446629%2131a3cee7')
# 2
div = driver.find_element_by_class_name('_2F3__SgJeuwKjU27Ngd6Pr')
ul = div.find_element_by_tag_name('ul')
element = ul.find_elements_by_tag_name('li')[0]
# 3
js = """
function(t) {
if (t.target === t.currentTarget || t.timeStamp >= i || t.timeStamp <= 0 || t.target.ownerDocument !== document) return o.apply(this, arguments)
}
"""
driver.execute_script(js.click(), element)