Python 2.7 使用onclick属性抓取网页

Python 2.7 使用onclick属性抓取网页,python-2.7,onclick,scrapy,Python 2.7,Onclick,Scrapy,我试图涂鸦一个网页,但它在意大利语默认,所以我需要切换到英语语言。 这是第页中的一段代码: <td class="lang"> [<a href="#" class="active" onclick="return SwitchLang('it')">ita</a> | <a href="#" onclick="return SwitchLang('en')">eng</a>] </td> 但它得到了错误

我试图涂鸦一个网页,但它在意大利语默认,所以我需要切换到英语语言。 这是第页中的一段代码:

<td class="lang">
    [<a href="#" class="active" onclick="return SwitchLang('it')">ita</a> | 
    <a href="#" onclick="return SwitchLang('en')">eng</a>]
</td>
但它得到了错误:

raise ValueError('No <form> element found with %s' % formxpath)
exceptions.ValueError: No <form> element found with /td[@class="lang"]/a[2]
如何“单击”并更改语言?
谢谢

你不能用scrapy。你能给我看一下你要抓取的网址和你的蜘蛛的全部代码吗?您可以尝试一些变通方法。我使用了Selenium来实现它和它的工作原理。
raise ValueError('No <form> element found with %s' % formxpath)
exceptions.ValueError: No <form> element found with /td[@class="lang"]/a[2]