moon icon indicating copy to clipboard operation
moon copied to clipboard

Interact with existing session?

Open huang-jy opened this issue 3 years ago • 2 comments

Hi there, I've been looking for a way to download the results of tests from a moon session pod so they can be made available to the CI/CD pipeline. I found the documentation here: https://aerokube.com/moon/latest/#_accessing_files_downloaded_with_browser

But I have a question.

During the process of running the test, the local terminal sends off the request to moon, and moon then runs the test, saving the files locally to the pod, and accessible via the URLs specified in the documentation. My question is this.: In order to access those files, I need to end the current python session which triggered the moon pod, go and download the results from the URLs, then reconnect to the session and terminate it cleanly. Yes, I can wait for the timeout, but I'd rather have testers cleanup tests as they go as a matter of habit.

Assuming I can note the session ID, how do I reconnect with the session so I can terminate it properly?

huang-jy avatar Feb 13 '22 18:02 huang-jy

@huang-jy Moon is fully W3C Webdriver protocol compatible. So every action like opening a new session, opening URL in browser, downloading a file and terminating a session is a separate HTTP request. To delete a session you can send an HTTP request like this:

DELETE /wd/hub/session/<id> # /wd/hub is actually just a constant prefix

Usually your Selenium client does this when you do driver.quit().

vania-pooh avatar Feb 14 '22 04:02 vania-pooh

Usually your Selenium client does this when you do driver.quit().

Yes, and I am particular about making sure both the session and the driver call .quit() before ending, but in order to download the files from the session, I need it to stay up after I close out (without closing the session)

Thanks for the details about the delete call -- I couldn't find mention of it on the documentation and didn't think of checking the actual webdriver documentation.

huang-jy avatar Feb 14 '22 07:02 huang-jy