0
我必須點擊我發現的鏈接,但是當我運行該腳本時,它會點擊第一個鏈接,我該如何修復它? 進口機械化點擊第一個鏈接mechanize python
BR = mechanize.Browser()
br.addheaders = [( 「用戶代理」, 「瀏覽器」)]
br.set_handle_robots(假)
而True:
kaynak = br.open("https://temp-mail.org/en/option/change/")
br.select_form(nr=0)
email = br.form.find_control(id='mail', name='mail')
email.value = "something"
submit = br.submit(nr=0)
go = br.open("https://temp-mail.org/en/option/refresh/")
target_text = 'Facebook'
for link in br.links():
print(link)
print(link.text)
if link.text == target_text:
print('match found')
break
br.follow_link(link)
print(br.geturl())