Using Twill's submit function when website's submit button is localized(Python)

旧城冷巷雨未停 提交于 2019-12-04 15:51:04

I've been experiencing the same issue for a site I'm creating but I think I've solved it.

use the twill's formaction() function to set the action for the page you want. For example

    from twill.commands import *
    go('http://example.com/login')
    showforms() 
    fv("1", "nameField", "username")
    fv("1", "password", "password")
    formaction('form','http://example.com/login')
    submit("4")
    show()
    go('http://example.com/admin/')

or in your case

from twill.commands import *
go('panel.picklehosting.com/index.php?r=site/login')
showforms()
formclear('1')
fv("1", "name", "usrname")
fv("1", "password", "mypass")
formaction('form','panel.picklehosting.com/index.php?r=site/login')
submit()
go('panel.picklehosting.com/yourpage.php')
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!