Cannot retrieve element (get a null response)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot retrieve element (get a null response)

José Román | Idiria S.L.

Hi!,

I am trying to get an input element from this web:

https://www.milanuncios.com/textos-del-anuncio/?demandax=n&c=131&idlocalidad=8&p=almeria&x=27&y=0

The input itself is:

<input class="inputs campoGrande" name="marca" value="" maxlength="120" size="12" id="marca" tabindex="1" type="text">

I have tried different approaches but all I always get is a "null" reference:

HtmlInput inputZona = (HtmlInput) currentPage.getElementById("marca");
HtmlInput inputZona = (HtmlInput) currentPage.getFirstByXPath("//input[@name='marca']");

Also tried JSoup with same results :-(

Both, HTMLUnit and XPAth fail to get the item.

What is going on with this?

Thanks in advance,




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Cannot retrieve element (get a null response)

albu77

DId you try this:

HtmlForm form = (HtmlForm) page.getByXPath("/html/body/form").get(0);
HtmlTextInput name = form.getInputByName("marca");

Anyway first thing to do is test with devtools int he website if it is correct check javascript error

And last but not least your best friend is the Firefox extension:

htmlunitscripter



Le 19/07/2017 à 13:52, José Román | Idiria S.L. a écrit :

Hi!,

I am trying to get an input element from this web:

https://www.milanuncios.com/textos-del-anuncio/?demandax=n&c=131&idlocalidad=8&p=almeria&x=27&y=0

The input itself is:

<input class="inputs campoGrande" name="marca" value="" maxlength="120" size="12" id="marca" tabindex="1" type="text">

I have tried different approaches but all I always get is a "null" reference:

HtmlInput inputZona = (HtmlInput) currentPage.getElementById("marca");
HtmlInput inputZona = (HtmlInput) currentPage.getFirstByXPath("//input[@name='marca']");

Also tried JSoup with same results :-(

Both, HTMLUnit and XPAth fail to get the item.

What is going on with this?

Thanks in advance,





------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Cannot retrieve element (get a null response)

José Román | Idiria S.L.
Hi, 

Thanks a lot for your response!. Just a couple of seconds before your mail I managed to do it by using XPath absolute navigation path... (/html/body/div/...).

Thanks again

El 19 jul. 2017 2:51 p. m., "Albu Gmail" <[hidden email]> escribió:

DId you try this:

HtmlForm form = (HtmlForm) page.getByXPath("/html/body/form").get(0);
HtmlTextInput name = form.getInputByName("marca");

Anyway first thing to do is test with devtools int he website if it is correct check javascript error

And last but not least your best friend is the Firefox extension:

htmlunitscripter



Le 19/07/2017 à 13:52, José Román | Idiria S.L. a écrit :

Hi!,

I am trying to get an input element from this web:

https://www.milanuncios.com/textos-del-anuncio/?demandax=n&c=131&idlocalidad=8&p=almeria&x=27&y=0

The input itself is:

<input class="inputs campoGrande" name="marca" value="" maxlength="120" size="12" id="marca" tabindex="1" type="text">

I have tried different approaches but all I always get is a "null" reference:

HtmlInput inputZona = (HtmlInput) currentPage.getElementById("marca");
HtmlInput inputZona = (HtmlInput) currentPage.getFirstByXPath("//input[@name='marca']");

Also tried JSoup with same results :-(

Both, HTMLUnit and XPAth fail to get the item.

What is going on with this?

Thanks in advance,





------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user