Próbuję pisać testy Selenium, aby wybrać przycisk opcji. Poniżej znajduje się html z "widoku źródła".Wybierz przycisk opcji PrimeFaces za pomocą Selenium Webdriver
<table id="surveyForm:surveyUrlType" class="ui-selectoneradio ui-widget" style="width:100%;margin-top:10px;margin-bottom: 10px;">
<tbody>
<tr>
<td>
<div class="ui-radiobutton ui-widget">
<div class="ui-helper-hidden-accessible">
<input id="surveyForm:surveyUrlType:0" name="surveyForm:surveyUrlType" type="radio" value="TYPED" checked="checked" onchange="com.ssi.feasibility.surveyView.showSurveyType(this);">
</div>
<div class="ui-radiobutton-box ui-widget ui-corner-all ui-state-default ui-state-active">
<span class="ui-radiobutton-icon ui-icon ui-icon-bullet"></span>
</div>
</div>
</td>
<td><label for="surveyForm:surveyUrlType:0">Enter Survey URL</label></td>
<td>
<div class="ui-radiobutton ui-widget">
<div class="ui-helper-hidden-accessible">
<input id="surveyForm:surveyUrlType:1" name="surveyForm:surveyUrlType" type="radio" value="FILE" onchange="com.ssi.feasibility.surveyView.showSurveyType(this);">
</div>
<div class="ui-radiobutton-box ui-widget ui-corner-all ui-state-default">
<span class="ui-radiobutton-icon"></span>
</div>
</div>
</td>
<td><label for="surveyForm:surveyUrlType:1">Upload Survey URLs</label></td>
</tr>
</tbody>
</table>
Chcę wybrać opcję "Prześlij adresy URL ankiet".
Próbowałem kilka różnych podejść, aby wybrać przycisk opcji. Oto kilka:
$("#surveyForm\\surveyUrlType").click();
This gives me the error :
$("#surveyForm\\:surveyUrlType\\:1").first().click()
Błąd- Element nie może zostać kliknięty w punkcie (809, 367). Drugim elementem otrzyma kliknięcie ...
Poniżej dać mi NoSuchElementFound:
driver.findElement(By.id("surveyForm:surveyUrlType:1")).click()
driver.findElement(By.xpath("//input[@type='radio' and @id='surveyForm\\:surveyUrlType\\:1']")).click()
driver.findElement(By.xpath("//input[@value='FILE']")).click()
driver.findElement(By.cssSelector("#surveyForm\\:surveyUrlType\\:1")).click()
Poniżej nie daje mi żadnego błędu, ale też nie wybrać opcję.
$(".ui-radiobutton-box ui-widget ui-corner-all ui-state-default")[1].click()
$(".ui-radiobutton-box ui-widget ui-corner-all ui-state-default").click()
$("#surveyForm\\:surveyUrlType").find(".ui-radiobutton-box ui-widget ui-corner-all ui-state-default").find("span").click()
Ale żadna z nich nie działa. czego mi brakuje?
Znajduje się w oknie dialogowym Główne. Mogę uzyskać dostęp do innych pól wprowadzania na stronie i manipulować ich wartościami. Ale tylko ten przycisk opcji. Pierwszy z nich jest wstępnie wybrany. Chcę wybrać drugi. Nie, nie próbowałem WebDriverWait. – user1860447