mardi 11 juin 2019

Is there a way to select a dropdown using its display name where the dropdown is populated from the database not from a HTML?

I was wondering if there was a way to select a selection from the dropdown menu where all the selection is populated from the database and does not have any selectors.

As it does not have any selectors we cannot use await page.select("selector",'dropdown') I have also tried using

await page.evaluate(() => {
  document.querySelector(`select [value="District"]`).selected = true);
});

Right now just to make it work I am using

    Page.keyboard.press('ArrowDown')
    page.keyboard.press('ArrowDown')
    page.keyboard.press('Enter')

which selects the selection I want but I don't think this is an appropriate way to select a selection from a dropdown.

There must be a proper way, Any help is highly appreciated!

Aucun commentaire:

Enregistrer un commentaire