Open tp6g04jp6 opened 7 years ago
No answer? Also need help with this.
Doesn't this work?
horseman.select('#main_road', 'A') // Select first option
Could not succeed. Can i select by index?
No you cannot select by index.
It is weird to me that the option
tags do not have a value
. The default for value
is supposed to be the text inside the option
tag. If that does not work, I do not know how to select it short of something like:
horseman.evaluate(function() {
// Select first option
$('#main_road :nth-child(1)').prop('selected', true);
});
First of all thank you for your help. I tried your code and it should work, but i realised that not in my case, in website i'm crawling i think where is onclick event when selecting (That is why there is no value in option). So i should simulate click on option. Any chance to do this?
You should be able to just click on it then.
horseman.click('#main_road :nth-child(1)')
Didn't work. Should i open/click Select element before click?
How to select an option without value?
For example: HTML: