简体   繁体   中英

How to click a button on a website?

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.

而不是alt ,要检查的更好的元素是id这是为了提供唯一的标识符 ,尽管您需要将其添加到输入标签中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM