File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,3 +81,36 @@ def test_create_session_forceMjsonwp(self):
8181
8282 assert driver .session_id == 'session-id'
8383 assert driver .w3c is False
84+
85+ @httpretty .activate
86+ def test_create_session_change_session_id (self ):
87+ httpretty .register_uri (
88+ httpretty .POST ,
89+ 'http://localhost:4723/wd/hub/session' ,
90+ body = '{ "value": { "sessionId": "session-id", "capabilities": {"deviceName": "Android Emulator"}}}'
91+ )
92+
93+ httpretty .register_uri (
94+ httpretty .GET ,
95+ 'http://localhost:4723/wd/hub/session/another-session-id/title' ,
96+ body = '{ "value": "title on another session id"}'
97+ )
98+
99+ desired_caps = {
100+ 'platformName' : 'Android' ,
101+ 'deviceName' : 'Android Emulator' ,
102+ 'app' : 'path/to/app' ,
103+ 'automationName' : 'UIAutomator2'
104+ }
105+ driver = webdriver .Remote (
106+ 'http://localhost:4723/wd/hub' ,
107+ desired_caps
108+ )
109+
110+ # current session
111+ assert driver .session_id == 'session-id'
112+
113+ # call against another session id
114+ driver .session_id = 'another-session-id'
115+ assert driver .title == 'title on another session id'
116+ assert driver .session_id == 'another-session-id'
You can’t perform that action at this time.
0 commit comments