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 28-Dec-12 0:48am
punkiv340
Edited 28-Dec-12 1:02am
(no name)33.9K
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 OriginalGriff 390
1 Sergey Alexandrovich Kryukov 329
2 Afzaal Ahmad Zeeshan 244
3 BillWoodruff 210
4 Maciej Los 192
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web04 | 2.8.141216.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