我想单击 Xpath 和 Id 信息如下的单选选项按钮:-
<input id="ContentView_PageLayout_FlightFinderTab_HomepageTabs_FlightsTab_pnlTripType_TripType#0"
type="radio" onclick="showHideReturningDate('return');" checked="checked" value="Return"
name="ContentView$PageLayout$FlightFinderTab$HomepageTabs$FlightsTab$pnlTripType$TripType">
Xpath:
//*[@id="ContentView_PageLayout_FlightFinderTab_HomepageTabs_FlightsTab_pnlTripType_TripType#0"]
<input id="ContentView_PageLayout_FlightFinderTab_HomepageTabs_FlightsTab_pnlTripType_TripType#1"
type="radio" onclick="showHideReturningDate('oneway');"
value="One Way" name="ContentView$PageLayout$FlightFinderTab$HomepageTabs$FlightsTab$pnlTripType$TripType">
Xpath:
//*[@id="ContentView_PageLayout_FlightFinderTab_HomepageTabs_FlightsTab_pnlTripType_TripType#1"]
我尝试了这些方法来获取 ID:
1:
return By.XPath("(//input[@id="++'ContentView_PageLayout_FlightFinderTab_HomepageTabs_FlightsTab_pnlTripType_TripType#1']");
2:
return By.Id("ContentView_PageLayout_FlightFinderTab_HomepageTabs_FlightsTab_pnlTripType_TripType#1");
3:
return By.XPath("//*[@id=" + '"' + "ContentView_PageLayout_FlightFinderTab_HomepageTabs_FlightsTab_pnlTripType_TripType#1" + '"' + "]");