Skip to content

How to get the option value from <Select>tag? #91

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
AngangGuo opened this issue Jan 8, 2021 · 2 comments
Closed

How to get the option value from <Select>tag? #91

AngangGuo opened this issue Jan 8, 2021 · 2 comments
Labels

Comments

@AngangGuo
Copy link

For example:

<select id="p-lang">
<option value="">Make a selection...</option>
<option value="go">Go</option>
<option value="html">HTML</option>
<option value="css">CSS</option>
<option selected="selected" value="php">PHP</option>
<option value="js">JavaScript</option>
</select>

How can I get the value "php" or the test "PHP" from the select tag?
Thanks.

@mxschmitt
Copy link
Collaborator

selectedValue, err := page.EvalOnSelector("#p-lang", "e => e.value")

that should work.

@AngangGuo
Copy link
Author

Yes, that work great.
Thanks.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants