Skip to content

added get session details sample scripts #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 16, 2022

Conversation

kamal-kaur04
Copy link
Collaborator

No description provided.

Copy link
Contributor

@asambstack asambstack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

asambstack
asambstack previously approved these changes Mar 15, 2022
catch (Exception err) {
await MarkTestStatus("failed", err.Message, page);
}
Object sessionObject = await page.EvaluateAsync("_ => {}", "browserstack_executor: {\"action\":\"getSessionDetails\"}");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will come after else block. If page is destroyed and comes in catch block and post which we try to getSessionDetails it will throw error.

Browser browser = chromium.connect(ws_endpoint);
BrowserContext context = browser.newContext(new Browser.NewContextOptions()
.setUserAgent("Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4943.0 Mobile Safari/537.36")
.setViewportSize(393, 727)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we fetch this viewport from devices json based on device name?

mark_test_status("failed", str(err), page)

# get details of the session
response = page.evaluate("_=> {}", 'browserstack_executor: {"action": "getSessionDetails"}')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be before except block

Copy link
Collaborator

@karanshah-browserstack karanshah-browserstack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@francisf francisf merged commit 40ad045 into browserstack:main Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants