Python TBS:Tor页面立即关闭
我正在尝试将Tor与selenium结合使用,它通过使用tbselenium来工作 但是,当加载url或单击web元素时,页面会在完成操作时立即关闭,而不是像在chrome中使用selenium那样保持打开状态 有什么办法保持页面打开吗Python TBS:Tor页面立即关闭,python,selenium,tor,Python,Selenium,Tor,我正在尝试将Tor与selenium结合使用,它通过使用tbselenium来工作 但是,当加载url或单击web元素时,页面会在完成操作时立即关闭,而不是像在chrome中使用selenium那样保持打开状态 有什么办法保持页面打开吗 import tbselenium.common as cm from tbselenium.tbdriver import TorBrowserDriver from tbselenium.utils import launch_tbb_tor_with_st
import tbselenium.common as cm
from tbselenium.tbdriver import TorBrowserDriver
from tbselenium.utils import launch_tbb_tor_with_stem
tbb_dir = "C:\\pathto\\Tor Browser\\"
tor_process = launch_tbb_tor_with_stem(tbb_path=tbb_dir)
for i in range(1):
with TorBrowserDriver(tbb_dir, tor_cfg=cm.USE_STEM) as driver:
driver.load_url("http://hln.be",3,wait_for_page_body=True)
#driver.get('https://google.be')
try:
policypage=driver.find_element_by_xpath("//a[contains(@href,'members/join')]")
policypage.click()
usern=driver.find_element_by_xpath("//input[contains(@id,'user_member_username')]")
usern.send_keys('Tryout')
except:
print('different look')
正如Furas所说,使用标准驱动程序声明。使用标准
driver=TorBrowserDriver(tbb\u dir,tor\u cfg=cm.use\u STEM)
。当您将与
一起使用时,它(可能)会在离开与
时自动关闭它。