Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nodebug/selenium

Package Overview
Dependencies
Maintainers
2
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nodebug/selenium - npm Package Compare versions

Comparing version 4.3.1 to 4.3.3

16

app/browser/elements.js

@@ -49,4 +49,4 @@ const { By } = require('selenium-webdriver')

relativeElement.rect.top >= element.rect.bottom &&
relativeElement.rect.left - 5 <= element.rect.left &&
relativeElement.rect.right + 5 >= element.rect.right
relativeElement.rect.left <= element.rect.midx &&
relativeElement.rect.right >= element.rect.midx
)

@@ -65,4 +65,4 @@ })

relativeElement.rect.bottom <= element.rect.top &&
relativeElement.rect.left - 5 <= element.rect.left &&
relativeElement.rect.right + 5 >= element.rect.right
relativeElement.rect.left <= element.rect.midx &&
relativeElement.rect.right >= element.rect.midx
)

@@ -81,4 +81,4 @@ })

relativeElement.rect.left >= element.rect.right &&
relativeElement.rect.top - 5 <= element.rect.top &&
relativeElement.rect.bottom + 5 >= element.rect.bottom
relativeElement.rect.top <= element.rect.midy &&
relativeElement.rect.bottom >= element.rect.midy
)

@@ -97,4 +97,4 @@ })

relativeElement.rect.right <= element.rect.left &&
relativeElement.rect.top - 5 <= element.rect.top &&
relativeElement.rect.bottom + 5 >= element.rect.bottom
relativeElement.rect.top <= element.rect.midy &&
relativeElement.rect.bottom >= element.rect.midy
)

@@ -101,0 +101,0 @@ })

@@ -13,2 +13,3 @@ const prefs = require('./preferences')

'--disable-notifications',
'--enable-automation',
],

@@ -15,0 +16,0 @@ prefs,

@@ -32,4 +32,4 @@ const { log } = require('@nodebug/logger')

message = `Selecting '${a.data}' from dropdown `
} else if (a.action === 'isVisible' || a.action === 'isDisabled') {
message = `Checking `
} else if (a.action === 'isVisible' || a.action === 'isDisabled' || a.action === 'isChecked' || a.action === 'isNotChecked') {
message = `Validating `
} else if (

@@ -41,5 +41,5 @@ a.action === 'waitVisibility' ||

} else if (a.action === 'check') {
message = `Checking checkbox for `
message = `Checking `
} else if (a.action === 'uncheck') {
message = `Unchecking checkbox for `
message = `Unchecking `
} else if (a.action === 'screenshot') {

@@ -103,2 +103,6 @@ message = `Capturing screenshot of `

message += `is disabled`
} else if (a.action === 'isChecked') {
message += `is checked`
} else if (a.action === 'isNotChecked') {
message += `is not checked`
} else if (a.action === 'click') {

@@ -105,0 +109,0 @@ if (a.x !== null && a.y !== null) {

@@ -8,3 +8,2 @@ const { log } = require('@nodebug/logger')

// const Alert = require('./app/alerts')
// const Visual = require('./app/visual')
class Driver extends Browser {

@@ -559,3 +558,3 @@ constructor() {

const locator = await this.finder(null, 'check')
const isChecked = await locator.isSelected()
const isChecked = await this.getCheckboxState()
if (

@@ -567,9 +566,8 @@ (action === 'check' && !isChecked) ||

}
if (isChecked === (await locator.isSelected())) {
if (
(action === 'check' && !isChecked) ||
(action === 'uncheck' && isChecked)
) {
await this.driver.executeScript('return arguments[0].click();', locator)
}
const confirmIsChecked = await this.getCheckboxState()
if (
(action === 'check' && !confirmIsChecked) ||
(action === 'uncheck' && confirmIsChecked)
) {
await this.driver.executeScript('return arguments[0].click();', locator)
}

@@ -588,2 +586,31 @@ } catch (err) {

async getCheckboxState() {
let checked = false
try {
const locator = await this.finder(null, 'check')
if(locator.tagName === 'input'){
checked = await locator.isSelected()
} else if(locator.tagName === 'md-checkbox'){
checked = await locator.getAttribute('aria-checked')
} else {
checked = await locator.getAttribute('value')
}
checked = JSON.parse(checked)
} catch (err) {
log.error(
`${this.message}\n${err.stack}`,
)
this.stack = []
err.message = `Error while ${this.message}\n${err.message}`
throw err
}
if (checked) {
log.info('Checkbox is checked.')
} else {
log.info('Checkbox is not checked.')
}
return checked
}
async check() {

@@ -599,2 +626,30 @@ this.message = messenger({ stack: this.stack, action: 'check' })

async isChecked() {
this.message = messenger({ stack: this.stack, action: 'isChecked' })
const checked = await this.getCheckboxState()
if (!checked) {
log.info(`Error while ${this.message}\nCheckbox is not checked.`)
err.message = `Error while ${this.message}\nCheckbox is not checked.`
throw err
}
this.stack = []
return true
}
async isNotChecked() {
this.message = messenger({ stack: this.stack, action: 'isNotChecked' })
const checked = await this.getCheckboxState()
if (checked) {
log.info(`Error while ${this.message}\nCheckbox is checked.`)
err.message = `Error while ${this.message}\nCheckbox is checked.`
throw err
}
this.stack = []
return true
}
async isUnchecked(){
await this.isNotChecked()
}
async isDisabled() {

@@ -788,3 +843,3 @@ this.message = messenger({ stack: this.stack, action: 'isDisabled' })

member.hidden = og.hidden
this.stack.push(member)
// this.stack.push(member)
} else {

@@ -1010,13 +1065,4 @@ this.stack.push(og)

}
// async visual(path) {
// const name = await browser.name()
// const os = await browser.os()
// const rect = await browser.getSize()
// const image = await screenshot()
// return Visual.compare(name, os, rect, image, path)
// }
}
module.exports = Driver
{
"name": "@nodebug/selenium",
"version": "4.3.1",
"version": "4.3.3",
"author": {

@@ -16,3 +16,3 @@ "name": "Node Bug",

"chai": "4.3.7",
"selenium-webdriver": "^4.18.1",
"selenium-webdriver": "4.18.1",
"sharp": "0.32.1"

@@ -19,0 +19,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc