我正在尝试单击网站上的某个按钮。这是它的代码。
<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>
目前,我在按钮中使用此代码点击“alt="Click to find Tickets"。
For Each webpageelement As HtmlElement In allelements
If webpageelement.GetAttribute("alt") = "Click to Find Tickets" Then
webpageelement.InvokeMember("click")
End If
它可以工作,但问题是网站上的另一个区域也使用了该 alt。因此它要求输入用户名和密码。我的代码行目前在一个按钮中。