How to login to a website with python and mechanize

前端 未结 2 2225
南笙
南笙 2020-12-24 03:17

i\'m trying to log in to the website http://www.magickartenmarkt.de and do some analyzing in the member-area (https://www.magickartenmarkt.de/?mainPage=showWants). I saw oth

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-24 03:49

    Web automation ? Definitely "WEBBOT"

    webbot works even for webpages with dynamically changing id and classnames and has more methods and features than selenium.

    Here's a snippet :)

    from webbot import Browser 
    web = Browser()
    web.go_to('google.com') 
    web.click('Sign in')
    web.type('mymail@gmail.com' , into='Email')
    web.click('NEXT' , tag='span')
    web.type('mypassword' , into='Password' , id='passwordFieldId') # specific selection
    web.click('NEXT' , tag='span') # you are logged in ^_^
    

提交回复
热议问题