Skip to content

Method Chaining #928

@entrptaher

Description

@entrptaher

You can chain the commands on other Nightmare, Chromeless etc. You can provide selector along with type(). Like the following. A total of 188 characters. The chain methods are still doable with the seperate awaits.

const awesomeness = await chromeless
  .goto('https://example.com')
  .type("*****", "#login_username")
  .type("*****","#login_password")
  .click("button")
  .wait(20000)
  .screenshot()

for the same thing we have to write the await multiple times. A total of 244 characters.

await page.goto('https://example.com');
await page.click("#login_username")
await page.type("*****")
await page.click("#login_password")
await page.type("*****")
await page.click(" button")
await page.waitFor(2000) 
await page.screenshot({path: 'screenshot.png'});

What should be done to achieve the chain methods for clean coding and innerpeace?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions