"Error No session in progress" 使用 webdriver-w3c 的简单示例的错误
"Error No session in progress" error for simple example using webdriver-w3c
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Web.Api.WebDriver.Endpoints
import Web.Api.WebDriver
main :: IO ()
main = do
x <- execWebDriverT defaultWebDriverConfig doLogin
print x
doLogin :: WebDriverT IO ()
doLogin = do
fullscreenWindow
navigateTo "http://localhost:8001/login"
z <- findElements CssSelector "div.alert"
assertEqual [] z "Errors found"
以上代码导致错误:
2021-12-13 16:32:39 ERROR Error No session in progress (Left (E
NoSession),S {_httpOptions = Options { manager = Left _, proxy =
Nothing, auth = Nothing, headers = [("User-Agent","haskell
wreq-0.5.3.2")], params = [], redirects = 10, cookies = Just (CJ
{expose = []}) }, _httpSession = Nothing, _userState = WDState
{_sessionId = Nothing, _breakpoints = BreakpointsOff}},W {unW =
[LogEntry {_logEntryTimestamp = 2021-12-13 16:32:39.03282154 UTC,
_logEntryUID = "", _logEntrySeverity = LogError, _logEntry = L_Error NoSession}]})
这个错误说明了什么?我错过了什么?
完整的示例项目可以在这里找到:https://github.com/chrissound/434/commit/ea1f3d840b64093b40ebba0e3dfceaacd4b36716
该错误表明 'webdriver' 上没有初始化会话。
A session is equivalent to a single instantiation of a particular user agent, including all its child browsers. WebDriver gives each session a unique session ID that can be used to differentiate one session from another, allowing multiple user agents to be controlled from a single HTTP server, and allowing sessions to be routed via a multiplexer (known as an intermediary node).
https://www.w3.org/TR/webdriver/#sessions
会话可以 created/managed 具有:
x <- execWebDriverT defaultWebDriverConfig $
runIsolated defaultFirefoxCapabilities doLogin
而不是 x <- execWebDriverT defaultWebDriverConfig doLogin
。
似乎 runIsolated
负责所有会话处理。
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Web.Api.WebDriver.Endpoints
import Web.Api.WebDriver
main :: IO ()
main = do
x <- execWebDriverT defaultWebDriverConfig doLogin
print x
doLogin :: WebDriverT IO ()
doLogin = do
fullscreenWindow
navigateTo "http://localhost:8001/login"
z <- findElements CssSelector "div.alert"
assertEqual [] z "Errors found"
以上代码导致错误:
2021-12-13 16:32:39 ERROR Error No session in progress (Left (E NoSession),S {_httpOptions = Options { manager = Left _, proxy = Nothing, auth = Nothing, headers = [("User-Agent","haskell wreq-0.5.3.2")], params = [], redirects = 10, cookies = Just (CJ {expose = []}) }, _httpSession = Nothing, _userState = WDState {_sessionId = Nothing, _breakpoints = BreakpointsOff}},W {unW = [LogEntry {_logEntryTimestamp = 2021-12-13 16:32:39.03282154 UTC, _logEntryUID = "", _logEntrySeverity = LogError, _logEntry = L_Error NoSession}]})
这个错误说明了什么?我错过了什么?
完整的示例项目可以在这里找到:https://github.com/chrissound/434/commit/ea1f3d840b64093b40ebba0e3dfceaacd4b36716
该错误表明 'webdriver' 上没有初始化会话。
A session is equivalent to a single instantiation of a particular user agent, including all its child browsers. WebDriver gives each session a unique session ID that can be used to differentiate one session from another, allowing multiple user agents to be controlled from a single HTTP server, and allowing sessions to be routed via a multiplexer (known as an intermediary node).
https://www.w3.org/TR/webdriver/#sessions
会话可以 created/managed 具有:
x <- execWebDriverT defaultWebDriverConfig $
runIsolated defaultFirefoxCapabilities doLogin
而不是 x <- execWebDriverT defaultWebDriverConfig doLogin
。
似乎 runIsolated
负责所有会话处理。