Skip to content

Commit

Permalink
Fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashohn committed Nov 15, 2024
1 parent 400c742 commit 028efcb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.
8 changes: 4 additions & 4 deletions lib/helper/WebDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ class WebDriver extends Helper {
this.isRunning = false
return this.browser.deleteSession()
}
if (this.browser.isInsideFrame) await this.browser.switchToFrame(null)
if (this.browser.isInsideFrame) await this.browser.switchFrame(null)

if (this.options.keepBrowserState) return

Expand Down Expand Up @@ -2574,16 +2574,16 @@ class WebDriver extends Helper {
async switchTo(locator) {
this.browser.isInsideFrame = true
if (Number.isInteger(locator)) {
return this.browser.switchToFrame(locator)
return this.browser.switchFrame(locator)
}
if (!locator) {
return this.browser.switchToFrame(null)
return this.browser.switchFrame(null)
}

let res = await this._locate(locator, true)
assertElementExists(res, locator)
res = usingFirstElement(res)
return this.browser.switchToFrame(res)
return this.browser.switchFrame(res)
}

/**
Expand Down
7 changes: 1 addition & 6 deletions test/helper/WebDriver.noSeleniumServer_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,7 @@ describe('WebDriver - No Selenium server started', function () {
it('should grab the innerHTML for an element', async () => {
await wd.amOnPage('/')
const source = await wd.grabHTMLFrom('#area1')
assert.deepEqual(
source,
`
<a href="/form/file" qa-id="test" qa-link="test"> Test Link </a>
`,
)
assert.deepEqual(source, '<a href="/form/file" qa-id="test" qa-link="test">Test Link</a>')
})
})

Expand Down
7 changes: 1 addition & 6 deletions test/helper/WebDriver_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,7 @@ describe('WebDriver', function () {
it('should grab the innerHTML for an element', async () => {
await wd.amOnPage('/')
const source = await wd.grabHTMLFrom('#area1')
assert.deepEqual(
source,
`
<a href="/form/file" qa-id="test" qa-link="test"> Test Link </a>
`,
)
assert.deepEqual(source, '<a href="/form/file" qa-id="test" qa-link="test"> Test Link </a>')
})
})

Expand Down
8 changes: 3 additions & 5 deletions test/helper/webapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,11 +757,9 @@ module.exports.tests = function () {
await I.amOnPage('/info')
const val = await I.grabHTMLFrom('#grab-multiple')
assert.equal(
`
<a id="first-link">First</a>
<a id="second-link">Second</a>
<a id="third-link">Third</a>
`,
`<a id="first-link">First</a>
<a id="second-link">Second</a>
<a id="third-link">Third</a>`,
val,
)
})
Expand Down

0 comments on commit 028efcb

Please sign in to comment.