Click here to Skip to main content
Rate this: bad
good
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 27-Dec-12 23:48pm
punkiv340
Edited 28-Dec-12 0:02am
33.1K
v3
Comments
TorstenH. at 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
0 Sergey Alexandrovich Kryukov 354
1 Richard MacCutchan 310
2 OriginalGriff 275
3 Vinay Mistry 163
4 Jared Sanow 145
0 Sergey Alexandrovich Kryukov 5,939
1 OriginalGriff 4,885
2 CPallini 2,473
3 Abhinav S 1,507
4 Richard MacCutchan 1,437


Advertise | Privacy | Mobile
Web02 | 2.8.140814.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2014
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