({{, (RefLink[StartWebSession, paclet:ref/StartWebSession])[]
starts a web session and returns a web session object.}, {, (RefLink[StartWebSession, paclet:ref/StartWebSession])["browser"]
starts a web session using the specified browser.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[StartWebSession, paclet:ref/StartWebSession]) creates a (RefLink[WebSessionObject, paclet:ref/WebSessionObject]) that represents a web browser being controlled by (RefLink[WebExecute, paclet:ref/WebExecute]).

By default, (RefLink[StartWebSession, paclet:ref/StartWebSession]) will bring up a visible web browser window on the screen. Commands in the web session will then be executed visibly in this window.

(RefLink[StartWebSession, paclet:ref/StartWebSession]) supports the following option:

Possible choices of "browser" include:

(RefLink[StartWebSession, paclet:ref/StartWebSession]) updates (RefLink[$CurrentWebSession, paclet:ref/$CurrentWebSession]) to the (RefLink[WebSessionObject, paclet:ref/WebSessionObject]) it creates.

(RefLink[DeleteObject, paclet:ref/DeleteObject])[(RefLink[WebSessionObject, paclet:ref/WebSessionObject])[…]] ends a session started by (RefLink[StartWebSession, paclet:ref/StartWebSession]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Start a web session with a "Chrome" browser:

session=StartWebSession["Chrome"]

Open a webpage, then capture it as an (RefLink[Image, paclet:ref/Image]):

WebExecute[session,{"OpenPage"->"https://wolfram.com", "CaptureWebPage"}]

End the session with (RefLink[DeleteObject, paclet:ref/DeleteObject]):

DeleteObject[session]

Start a web session:

session=StartWebSession["Chrome"]

Sessions are persistent across calls to (RefLink[WebExecute, paclet:ref/WebExecute]):

WebExecute[session,"OpenPage"->"https://www.wolframalpha.com"]

WebExecute[session,"PageTitle"]

End the session with (RefLink[DeleteObject, paclet:ref/DeleteObject]):

DeleteObject[session]

OpenersExampleSection1(Spacer1)Scope  (2)

Multiple web sessions can be run simultaneously:

Map[StartWebSession,{"Firefox","Chrome"}]

End the web sessions:

DeleteObject[%]

Multiple web sessions run in their own independent process:

sessions=Table[StartWebSession["Firefox"],2]

Map[#["Process"]&,sessions]

End the web sessions:

DeleteObject[sessions]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[$CurrentWebSession, paclet:ref/$CurrentWebSession])  ▪  (RefLink[WebSessions, paclet:ref/WebSessions])  ▪  (RefLink[WebExecute, paclet:ref/WebExecute])  ▪  (RefLink[WebSessionObject, paclet:ref/WebSessionObject])  ▪  (RefLink[StartExternalSession, paclet:ref/StartExternalSession])  ▪  (RefLink[StartProcess, paclet:ref/StartProcess])  ▪  (RefLink[Install, paclet:ref/Install])  ▪  (RefLink[DeleteObject, paclet:ref/DeleteObject])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Web Browser Automation, paclet:guide/WebBrowserAutomation])}, {▪(RefLinkPlain[HTTP Requests & Responses, paclet:guide/HTTPRequestsAndResponses])}, {▪(RefLinkPlain[Web Operations, paclet:guide/WebOperations])}, {▪(RefLinkPlain[Tuning & Debugging, paclet:guide/TuningAndDebugging])}})}})