Note that there are some explanatory texts on larger screens.

plurals
  1. POExecuting Javascript functions using scrapy in python
    primarykey
    data
    text
    <p>I am very new to "<strong>scrapy</strong>", i am scrapping a website and in that i had some anchor tags which consists of href attributes with <strong>java script SubmitForm functions</strong>. When i clicked that javascript function a page is opening from which i need to fetch data.I used <strong>Xpath</strong> and found href for particular anchor tags but unable to execute that href attribute that contains javascript function. Can anyone tell me how to execute javascript Submit functions of anchor tags in scrapy python.My HTML code is</p> <pre><code> &lt;table class="Tbl" cellspacing="2" cellpadding="0" border="0"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td class="TblOddRow"&gt; &lt;table cellspacing="0" cellpadding="0" border="0"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td valign="middle" nowrap=""&gt; &lt;a class="Page" alt="Click to view job description" title="Click to view job description" href="javascript:sysSubmitForm('frmSR1');"&gt;Accountant&amp;nbsp;&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>And spider code is </p> <pre><code>class MountSinaiSpider(BaseSpider): name = "mountsinai" allowed_domains = ["mountsinaicss.igreentree.com"] start_urls = [ "https://mountsinaicss.igreentree.com/css_external/CSSPage_SearchAndBrowseJobs.ASP?T=20120517011617&amp;", ] def parse(self, response): return [FormRequest.from_response(response, formdata={ "Type":"CSS","SRCH":"Search&amp;nbsp;Jobs","InitURL":"CSSPage_SearchAndBrowseJobs.ASP","RetColsQS":"Requisition.Key¤Requisition.JobTitle¤Requisition.fk_Code_Full_Part¤[Requisition.fk_Code_Full_Part]OLD.Description(sysfk_Code_Full_PartDesc)¤Requisition.fk_Code_Location¤[Requisition.fk_Code_Location]OLD.Description(sysfk_Code_LocationDesc)¤Requisition.fk_Code_Dept¤[Requisition.fk_Code_Dept]OLD.Description(sysfk_Code_DeptDesc)¤Requisition.Req¤","RetColsGR":"Requisition.Key¤Requisition.JobTitle¤Requisition.fk_Code_Full_Part¤[Requisition.fk_Code_Full_Part]OLD.Description(sysfk_Code_Full_PartDesc)¤Requisition.fk_Code_Location¤[Requisition.fk_Code_Location]OLD.Description(sysfk_Code_LocationDesc)¤Requisition.fk_Code_Dept¤[Requisition.fk_Code_Dept]OLD.Description(sysfk_Code_DeptDesc)¤Requisition.Req¤","ResultSort":"" }, callback=self.parse_main_list)] def parse_main_list(self, response): hxs = HtmlXPathSelector(response) firstpage_urls = hxs.select("//table[@class='Tbl']/tr/td/table/tr/td") for link in firstpage_urls: hrefs = link.select('a/@href').extract() </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload