Javascript 在azure服务器上使用基于selenium的python代码
Selemium使用浏览器打开页面并获取内容。但在我的azure服务器(基于命令行)上,我不能使用chrome或firefox。那么,在azure服务器上使用基于python的selenium代码的替代方案是什么呢 我看着一个无头浏览器。但我猜这是javascript,所以我需要在JS中转换python代码 还有其他更好的选择吗 代码段:Javascript 在azure服务器上使用基于selenium的python代码,javascript,python,azure,selenium,Javascript,Python,Azure,Selenium,Selemium使用浏览器打开页面并获取内容。但在我的azure服务器(基于命令行)上,我不能使用chrome或firefox。那么,在azure服务器上使用基于python的selenium代码的替代方案是什么呢 我看着一个无头浏览器。但我猜这是javascript,所以我需要在JS中转换python代码 还有其他更好的选择吗 代码段: driver = webdriver.Chrome() def getVideoTrend(self, item): driver.get(item[
driver = webdriver.Chrome()
def getVideoTrend(self, item):
driver.get(item['link'])
element = WebDriverWait(driver, 20).until(lambda driver: driver.find_elements_by_class_name('yvp-main'))
self.yahoo_video_trend = []
for s in driver.find_elements_by_class_name('yvp-main'):
print "Processing link - ", item['link']
trend = item
trend['video_link'] = s.find_element_by_tag_name('video').get_attribute('src')
print s.find_element_by_tag_name('video').get_attribute('src')
self.yahoo_video_trend.append(trend)
尝试根据您的浏览需要和解析使用
那么,在azure上使用基于python的selenium代码的替代方案是什么呢
服务器
我可以知道您是否正在使用Azure Web App吗?据我所知,Azure Web App不允许我们在服务器上安装自定义软件。因此,在这种情况下,您可能希望使用虚拟机。基于Windows的虚拟机预先启用了GUI,因此您只需使用远程桌面登录到服务器并安装浏览器(如果您不想使用默认IE)。对于Linux服务器,您可以先安装桌面,然后再安装浏览器。请参阅以查看此说明是否有帮助。@user464224:谢谢,但youtube、google、yahoo没有使用请求提供完整的html,因此这没有帮助