1
votes

I'm doing some scraping from a remote host, using Capybara with the Webkit driver (driving a form that uses JS).

The form is here.

The issue is I can't manage to select options by text, Capybara says it can't find them. E.g :

select("AICARDI René", from: "nom_message_annuaire")
Capybara::ElementNotFound: Unable to find option "AICARDI René"

The option exists. What gives?

Thanks!

1
I noticed that the tag looks like <option value="24">AICARDI&nbsp;René</option> Could this weird behaviour be because of the nbsp;?Ahmed Aeon Axan
@AhmedAeonAxan: actually, I had tried adding the &nbsp; and now I found something that works, will post answer. Anyway, thanks for checking it out!Andrei

1 Answers

2
votes

The issue was the &nbsp; inside the option's text.

I solved it with:

select(Nokogiri::HTML("AICARDI&nbsp;Réné").text, from: "nom_message_annuaire")