I’m trying to click a certain button on a website. Here is it’s code.
<div id="ff_submit_button">
<input type="image" onclick="javascript:return preFareFinderSubmitActions('The following information is needed to process your request:', 'Problem Pricing the Itinerary: Atlantic City Express Service offers adult fares only for all passengers. Please modify your selection to continue. \n[Error ID: 1121S]')" src="/images/en/btn_ff_go.gif" alt="Click to Find Tickets" border="0" name="_handler=url.presentation.handler.request.rail.urlRailSearchRequestHandler/_xpath=/sessionWorkflow/productWorkflow[@product='Rail']">
</div>
At the moment, I have it hitting the “alt=”Click to find tickets” with this code in a button.
For Each webpageelement As HtmlElement In allelements
If webpageelement.GetAttribute("alt") = "Click to Find Tickets" Then
webpageelement.InvokeMember("click")
End If
It works, but the problem is that there is another area on the website that also uses that alt. Thus it’s asking to enter a username and password. My line of code is in a button at the moment.
Rather than
alt, the better element to check for would beid– this is meant to provide a unique identifier, although you’d need to add it to your input tag.