在MechanicalSoup(python 3x)中如何注销其注销按钮是javascript的网站 [英] In MechanicalSoup (python 3x) how to logout a website whose logout button is a javascript

查看:324
本文介绍了在MechanicalSoup(python 3x)中如何注销其注销按钮是javascript的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以成功登录并浏览网站,但当我查看注销按钮时,它就像 javascript:__ doPostBack('ctl00 $ lnkBtnLogout','')作为链接, follow_link()对此不起作用(说:没有适配器)???有人可以帮帮我吗?

I could successfully login and navigate through a website but when I inspected the logout button it is like javascript:__doPostBack('ctl00$lnkBtnLogout','') as link, follow_link() doesn't work on this (saying: no adapters)??? Can someone help me?

推荐答案

来自 https://github.com/MechanicalSoup/MechanicalSoup


用于自动化交互的Python库网站。 MechanicalSoup自动存储和发送cookie,遵循重定向,并可以跟踪链接和提交表单。 它没有执行JavaScript。

这为您提供了两个选项。

This gives you two options.

阅读JavaScript。逆向工程。用Python重新实现它。弄清楚页面中的哪些数据是动态的,并且算法需要这些数据。使用MechanicalSoup解压缩并将其插入重新实现。

Read the JavaScript. Reverse engineer it. Reimplement it in Python. Figure out what data in the page is dynamic and needed for the algorithm. Extract that using MechanicalSoup and insert it into your reimplementation.

使用支持JavaScript的东西(例如Selenium或PhantomJS)。

Use something which does support JavaScript (such as Selenium or PhantomJS) instead.

这篇关于在MechanicalSoup(python 3x)中如何注销其注销按钮是javascript的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆