Akhil Seeramsetty
Akhil Seeramsetty

Reputation: 83

Trying to select a check box but not getting selected

<div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-imageModel" style="display: block; z-index: 1002; outline: 0px; height: auto; width: 700px; top: 225.5px; left: 278.5px;"><div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"><span class="ui-dialog-title" id="ui-dialog-title-imageModel">ATTENTION TAX PAYERS!!!!!</span><a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button" style="display: none;"><span class="ui-icon ui-icon-closethick">close</span></a></div><div id="imageModel" class="ui-dialog-content ui-widget-content" style="width: auto; min-height: 0px; height: 92.4px;" scrolltop="0" scrollleft="0">
    <ul><li class="redFont"> Please insist on getting Form 16/16A from your Deductor downloaded only from Traces.Valid form 16/16A.<a href="http://contents.tdscpc.gov.in/images/third-party-form-26AS.png" target="_blank"><i><u> click here.</u></i></a></li></ul>
    <div class="floatLeft margintop20"><input type="checkbox" id="Details" name="Details" onclick="checkModal('modalPagee')"> I agree to the usage and acceptance of Form 16 / 16A generated from TRACES</div>
    <div class="floatLeft margintop20">
&nbsp;&nbsp;&nbsp;
    <input value="Proceed" type="button" class="button" id="btn" disabled="disabled" onclick="goCancel()">  
   </div>
   </div></div>

This is the HTML code on which I am working, Here I want to select the input element of type checkbox, when I was trying it as

check_box = find_element_by_id("Details").click() I was failing to select it .

if need of more details in

"https://www.incometax.gov.in/iec/foportal" please visit this site,

when after login, goto -> e-file -> income_tax_returns -> view for 26as and continue, Then we will get another window opened and will get a popup here in pop up we need to select the checkbox.

Upvotes: 2

Views: 66

Answers (2)

Md. Fazlul Hoque
Md. Fazlul Hoque

Reputation: 16187

Try:

check_box = find_element_by_xpath('//*[@id="Details"]').click()

Upvotes: 1

cruisepandey
cruisepandey

Reputation: 29362

That details is in new tab, you need to switch the focus like below :

wait = WebDriverWait(driver, 10)
new_handle = driver.window_handles
print(len(new_handle))
driver.switch_to.window(new_handle[1])

wait.until(EC.element_to_be_clickable((By.ID, "Details"))).click()

Upvotes: 1

Related Questions