+21
-0
lines changedFilter options
+21
-0
lines changed Original file line number Diff line number Diff line change
@@ -801,7 +801,13 @@ class Actions {
801
801
* @return {!Actions} a self reference.
802
802
*/
803
803
sendKeys(...keys) {
804
+
const { WebElement } = require('./webdriver')
805
+
804
806
const actions = []
807
+
if(keys.length > 1 && keys[0] instanceof WebElement) {
808
+
this.click(keys[0]);
809
+
keys.shift()
810
+
}
805
811
for (const key of keys) {
806
812
if (typeof key === 'string') {
807
813
for (const symbol of key) {
Original file line number Diff line number Diff line change
@@ -239,6 +239,21 @@ suite(function (env) {
239
239
assert.strictEqual(await el.getAttribute('value'), 'foobar')
240
240
})
241
241
242
+
it('can send keys to designated element', async function () {
243
+
await driver.get(Pages.formPage)
244
+
245
+
let el = await driver.findElement(By.id('email'))
246
+
assert.strictEqual(await el.getAttribute('value'), '')
247
+
248
+
await driver.actions().sendKeys(el, 'foobar').perform()
249
+
250
+
await driver.wait(
251
+
async () => (await el.getAttribute('value')) === 'foobar',
252
+
10000
253
+
)
254
+
assert.strictEqual(await el.getAttribute('value'), 'foobar')
255
+
})
256
+
242
257
ignore(env.browsers(Browser.FIREFOX, Browser.SAFARI)).it(
243
258
'can scroll with the wheel input',
244
259
async function () {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4