'Scrapy-splash js-script execution

I need to click on an js=element on the page www.trisaelectronics.ch/en/Electric-grill-BBQ-Grill-800-7451.html (tab 'Additional documents' a[onclick^='sendAsyn']) and get a link to the pdf-file. I am trying to send a request with the following arguments:

SplashRequest(
url= url,
args={'wait': 5.0, 'lua_source': '''
function main(splash, args)
  assert(splash:go(args.url))
  assert(splash:wait(5))
  assert(splash:runjs("document.querySelector(".nav-tabs a[onclick^='sendAsyn']").click();"))
'''
}

but I don't get the result I need (links to pdf-documents). What's wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source