Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Selecting a input tag and clicking it if it doesn't have an href #434

Open
cverster opened this issue Jan 17, 2021 · 0 comments
Open

Selecting a input tag and clicking it if it doesn't have an href #434

cverster opened this issue Jan 17, 2021 · 0 comments

Comments

@cverster
Copy link

Hi there!

I'm pretty new to Goutte, and I've run into my first challenge already. I'm trying to navigate a .aspx site and I'm finding it hard to select the elements that I need and click them. The website starts out with an "Accept terms and conditions" page, basically one big form, and it has a button that I want to click with the following html:

<input type="submit" name="butAccept" value="I Accept the Conditions of Use" id="butAccept" accesskey="A" tabindex="1" title="Click this button to accept the Conditions of Use">

Next, a page appears where I want to input a number into an input field, and then click a submit button with a specific id / name. Here is the input field:

<input name="txtRequiredNumber" type="text" maxlength="13" id="txtRequiredNumber" accesskey="N" title="Enter Number or Identity Number here." style="width:182px;">

and here is the submit button:

<input type="submit" name="butFind" value="Find" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;butFind&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="butFind" accesskey="F" title="Click this button to find the required record" style="width:70px;">

I'm finding that something like the following is not working:

$client = new Client;
$crawler = $client->request('GET', 'https://www.sanc.co.za/eRegister.aspx');
$link = $crawler->filter('butAccept')->link();
$crawler = $client->click($link);

Can anyone tell me how to handle a page like this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant