Click here to Skip to main content
12,063,452 members (70,473 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Java
m facing problem in clicking Radio button in Selenium.

HTML code line for Radio button -
<input name="pft_ct_DebitCreditDet_wca_DR_CR_FLG" 
  class="spattrdtls" 
  id="pft_ct_DebitCreditDet_wca_DR_CR_FLG_rb1" 
  style="position: relative; height: 15px; top: 0px; left: 2px;"
  onclick="processClickOnRadioButton(this.parentElement,'pft_wc_DebitCreditDet.wca_DR_CR_FLG')"  
 önchange="return piC(event,this.parentElement)" 
type="radio" 
value="2"/>


in Selenium i have used xpath to click -

driver.findElement(
  By.xpath("HTML/BODY/FORM[@name='pft_w_InternalTransferForm']/DIV[@id='windowdiv']/DIV[@id='union1']/FIELDSET[@id='pft_ct_DebitCreditDet']/DIV[@id='pft_ct_DebitCreditDet_wca_DR_CR_FLG']/TABLE/TBODY/TR/TD/INPUT[@id='pft_ct_DebitCreditDet_wca_DR_CR_FLG_rb1']")
  ).click();

But still its not working..... I have traced it by System.out.print..... it is giving true for the path, means path is accessible. but radio is not being clicked....

[torsten] code in blocks[/torsten]
Posted 28-Dec-12 0:48am
punkiv340
Edited 28-Dec-12 1:02am
TorstenH.34.8K
v3
Comments
TorstenH. 28-Dec-12 6:03am
   
do you update the GUI afterwards? You need to redraw/repaint the panel after changing the control.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160204.4 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100