Wallaby -- can't find an element by id

On an html page there’s an input with a certain id.
use Wallaby.DSL

{:ok, session} = Wallaby.start_session()
visit(session, "some_url")
|> fill_in("#some_id", with: "Test1") # 1
#    |> fill_in(Query.css("#some_id"), with: "Test1") # 2

This throws an exception:

 ** (FunctionClauseError) no function clause matching in Wallaby.Browser.find/3
            (wallaby) lib/wallaby/browser.ex:444: Wallaby.Browser.find(%Wallaby.Session{driver: Wallaby.Phantom, ....

And the # 2 gives this exception:

** (Wallaby.QueryError) Expected to find 1, visible element that matched the css '#some_id' but 0, visible elements were found.

The element-input with id “some_id” exists on a page and is visible.

What can be the matter and how to fix that?

Hi there,

some sample HTML and version information would help. Plus maybe an issue over at the repo,I just looked here by coincidence.

The first variant is also removed since 0.17 iirc - the second should work imo :slight_smile:

  1. when I’m calling “page_source” it returns a different page source, quite short. even curl return the whole page correctly

  2. version 0.17.0

So please try to create a small project which shows your problem in a reproducable way.

Without seeing anything but a pseudofied wallaby test, we can’t help anyone.

If it works with curl and not with wallaby, I have to assume that you have a typo somewhere in your wallaby calls.

I’ve said: it returned the same html of the same web page, valid one, but shorter. How can do waiting in Wallaby?

Now it does return the whole html page, but:

PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.
/usr/bin/sh: line 13: kill: (8526) - No such process
/usr/bin/sh: line 10:  8526 Segmentation fault      (core dumped) "$@"

Why?

We can’t tell without knowing anything! Similar cases work for me.

Either you show us a minimal project which reproduces the problem or we won’t be able to help you with your problem.

2 Likes