I have been working on a web scraper that follows this process:
Visit site A -> click on the buy now button -> redirected to Amazon -> scrape data -> return to site A
The issue I am facing is that the site is built using AngularJS, and I am having trouble clicking the button with selenium.click()
To scrape the JavaScript page, I am using Selenium and Scrapy. The page has infinite scrolling, so I need a solution that works for such pages.
Below is the HTML snippet of the element in question:
<a class="external" href="http://www.amazon.com/dp/B01DBR53FU/?tag=097-20&ascsubtag=v7_3_3_3m7_2nhz_0_x01_-srt5-" target="_blank" analytics-on="click" analytics-event="button" analytics-category="outbound" analytics-label="non-lethal-salt-firing-self-defense-gun" ng-click="click(post)" rel="nofollow">Check it out </a>
The syntax I attempted to use was:
sel.xpath('//*[@class="button"]').click()
This resulted in an error message:
'SelectorList' object has no attribute 'click'