Skip to content

Commit 4b6af2e

Browse files
committed
[bidi][js] Add test to get iframe's browsing context
1 parent 46b3ac6 commit 4b6af2e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

javascript/node/selenium-webdriver/test/bidi/script.js renamed to javascript/node/selenium-webdriver/test/bidi/script_test.js

+17
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,23 @@ suite(
6767
assert.equal(result.result.value, 3)
6868
})
6969

70+
it('can call function to get iframe browsing context', async function () {
71+
await driver.get(Pages.iframePage)
72+
const id = await driver.getWindowHandle()
73+
const manager = await ScriptManager(id, driver)
74+
75+
const result = await manager.callFunctionInBrowsingContext(
76+
id,
77+
'() => document.querySelector(\'iframe[id="iframe1"]\').contentWindow',
78+
false
79+
)
80+
assert.equal(result.resultType, EvaluateResultType.SUCCESS)
81+
assert.notEqual(result.realmId, null)
82+
assert.equal(result.result.type, 'window')
83+
assert.notEqual(result.result.value, null)
84+
assert.notEqual(result.result.value.context, null)
85+
})
86+
7087
it('can call function with arguments', async function () {
7188
const id = await driver.getWindowHandle()
7289
const manager = await ScriptManager(id, driver)

0 commit comments

Comments
 (0)