Click here to Skip to main content
11,642,613 members (66,691 online)
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
(no name)34.8K
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 DamithSL 254
1 Sergey Alexandrovich Kryukov 204
2 OriginalGriff 160
3 Afzaal Ahmad Zeeshan 129
4 Mika Wendelius 85
0 Mika Wendelius 485
1 DamithSL 457
2 OriginalGriff 365
3 Afzaal Ahmad Zeeshan 258
4 Sergey Alexandrovich Kryukov 254


Advertise | Privacy | Mobile
Web04 | 2.8.150731.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2015
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