【发布时间】:2022-01-14 19:19:52
【问题描述】:
有一个我以前从未见过的非常奇怪的问题。我正在关注如何使用 Selenium 和 ChromeDriver 进行脚本浏览的教程。将 WebDriver.dll 和 chromedriver.exe 加载到我的工作目录后,我运行它
Add-Type -Path "$($WorkingDir.FullName)\WebDriver.dll"
$ChromeDriver = New-Object OpenQA.Selenium.Chrome.ChromeDriver
当我在对象上运行GetType() 时,它会显示
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False ChromeDriver OpenQA.Selenium.Chromium.ChromiumDriver
但是,当我尝试访问这些方法时,我只能得到这些
PS C:\repo\> $ChromeDriver.
ApplicationCache ApplicationCache ClearNetworkConditions GetType
Capabilities Close LaunchApp
CommandExecutor CloseDevToolsSession Manage
CurrentWindowHandle Dispose Navigate
FileDetector Equals PerformActions
HasActiveDevToolsSession ExecuteAsyncScript Print
HasApplicationCache ExecuteCdpCommand Quit
HasLocationContext ExecuteChromeCommand RegisterCustomDriverCommand
HasWebStorage ExecuteChromeCommandWithResult RegisterCustomDriverCommands
IsActionExecutor ExecuteCustomDriverCommand ResetInputState
LocationContext ExecuteScript SelectCastSink
NetworkConditions FindElement SetPermission
PageSource FindElements StartTabMirroring
SessionId GetCastIssueMessage StopCasting
Title GetCastSinks SwitchTo
Url GetDevToolsSession ToString
WebStorage GetHashCode
WindowHandles GetScreenshot
我缺少很多方法,比如这些
FindElement(By)
FindElementByClassName
FindElementById
FindElementByLinkText
FindElementByName
FindElementByPartialLinkText
FindElementByTagName
FindElementByXPath
提前致谢
编辑
我的系统遇到了一些其他问题,并且一直想重建它,所以我这样做了,我也遇到了同样的问题。
【问题讨论】: