关于Selenium储存sessionid 使用Selenium DotNET
我所使用的是Visual Studio 2022 Preview中的Selenium DotNET最近遇到网页登入一直会出现hCaptcha的问题所以参考了许多方法但是都是以Python为主
我看到一个方法就是储存SessionID以备下次登入时使用可以避免一直遇到人机验证问题
然后我修改一下到VS里面一直显示SessionID无法转换成String储存入txt档案中
请问一下SessionID是需要强制转换成String以供储存吗?
因为网路很少有Selenium DotNET的说明请问各位如果有相关网页麻烦指教一下
感谢大家
Public Sub ConnectSG()
Dim HTML_Source As String = ""
Dim sUserName As String = "账号"
Dim sPassWord As String = "密码"
Dim browser_option As New ChromeOptions
'browser_option.AddArgument("--disable-gpu")
'browser_option.AddUserProfilePreference("profile.default_content_setting_values.images", 2)
Dim NewUAC As String = Random_UAC()
browser_option.AddArgument("user-agent=" & NewUAC)
browser_option.AddArgument("--window-size=800,600")
browser_option.AddArgument("--disable-blink-features=AutomationControlled")
'browser_option.AddArgument("--headless")
Dim driverService = ChromeDriverService.CreateDefaultService
driverService.HideCommandPromptWindow = False
Dim browser As New ChromeDriver(driverService, browser_option)
browser.Navigate.GoToUrl(url_SG_Login)
Dim Waits As New WebDriverWait(browser, TimeSpan.FromSeconds(60))
Waits.Until(ExpectedConditions.ElementIsVisible(By.ClassName("forgot-pass")))
Dim SessionID = browser.SessionId
System.IO.File.AppendAllText("Session.txt", SessionID)
https://blog.csdn.net/Ljq730828/article/details/101801011 参考下这个 等大神 存为变量即可 顶一下,可以尝试下
页:
[1]