[英]How I can prevent to change my ip during browse the website by usening selenium pyhthon firefox
ther is my code when i visit this site ( https://www.myip.com/ ) and after 1 minute refresh the site my ip will change, my question is How I can prevent to change my ip during browse the website by usening selenium pyhthon firefox这是我访问此站点时的代码( https://www.myip.com/ ),刷新站点 1 分钟后,我的 ip 将发生变化,我的问题是如何防止在浏览网站时更改我的 Z957B527BCFBAD8 使用 932E80F58D20 selenium 蟒蛇 firefox
import os
import time
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver import FirefoxProfile
from selenium import webdriver
torexe = os.popen(r'C:\Users\sam\OneDrive\Desktop\Tor Browser\Browser\firefox.exe')
time.sleep(5)
binary = FirefoxBinary(r"C:\Users\sam\OneDrive\Desktop\Tor Browser\Browser\firefox.exe")
profile = FirefoxProfile(r"C:\Users\sam\OneDrive\Desktop\Tor Browser\Browser\TorBrowser\Data\Browser\profile.default")
profile.set_preference('network.proxy.type', 1)
profile.set_preference('network.proxy.socks', '127.0.0.1')
profile.set_preference('network.proxy.socks_port', 9150)
profile.update_preferences()
firefox_options = webdriver.FirefoxOptions()
driver = webdriver.Firefox(profile, binary)
driver.get("https://www.google.com/")
#driver.quit()
The answer is: You can't答案是:你不能Selemium
is definitely not a tool for such a things. Selemium
绝对不是这样的工具。
Your question is like: "What T-shirt should I wear in order to prevent the https://www.myip.com/ from changing my PC IP address"?您的问题是:“我应该穿什么 T 恤以防止https://www.myip.com/更改我的 PC IP 地址”?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.