skip to Main Content
<div class="category well clearfix well-1">
  <div class="row">
    <div role="tabpanel" class="col-md-8 form-group" id="tooltip-hide">
      <div class="input-group">
        <span class="input-group-addon">
          <label style="margin:0px;padding:0px;">Dates</label>
        </span>
        <input required="" type="text" name="report_range" id="repDateRange" placeholder="Select date range" class="form-control input-sm required" value="" readonly="" style="cursor:text; background:#fff;">
      </div>
      <div id="dateRangeError"></div>
    </div>
    <input type="hidden" name="date_range_type" value="">
    <input type="hidden" name="start_date" value="">
    <input type="hidden" name="end_date" value="">
  </div>
</div>

Using all the locators including absolute Xpath, I am unable to click on date text box. I have also tried using TABS, javascript click and Actions.

Page source

code steps

what we need to click

2

Answers


  1. The issue you are facing is because the window (pop-up) you are trying to acess isn’t handled as the same of the basic webpage, in short selenium can’t see it because it’s counted as an Add-on.

    you can try the following:

    1. This method gets the instance of the pop-up window.
      driver.window_handles[1]:

    2. This method switches to the given pop-up window.
      driver.switch_to.window(handle):

    Login or Signup to reply.
  2. Are you sure your element locator doesn’t return something unexpected like a different type or a List[]?

    print(str(driver.find_element(By.NAME, 'report_range')))
    print(str(driver.find_element(By.ID, 'repDateRange')))
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search