I am trying to locate an input field that comes in view after scrolling(horizontally), when i am trying to access it without scrolling, the error is "Element is not interactable".
release_level_edit = browser.find_by_xpath(
'/html/body/div[1]/div/div[1]/div[2]/div[4]/div[2]/div/div/div[2]/div[2]/div/div/div[2]/div/div/div[2]/div/div/div[2]/div/div/div[2]/div[2]/div/div[2]/div/div[1]/div/div/div[107]/div[2]/div/div[1]/div/div[1]/input')
release_level_edit.fill('Inserted')
release_level_edit.type('\ue007')
However when if i am using Action.move_by_offset() the error is move target out of bounds, here is the code
while True:
try:
release_level_edit = browser.find_by_xpath(
'/html/body/div[1]/div/div[1]/div[2]/div[4]/div[2]/div/div/div[2]/div[2]/div/div/div[2]/div/div/div[2]/div/div/div[2]/div/div/div[2]/div[2]/div/div[2]/div/div[1]/div/div/div[107]/div[2]/div/div[1]/div/div[1]/input')
release_level_edit.fill('Inserted')
release_level_edit.type('\ue007')
break
except Exception:
action_chains = ActionChains(browser.driver)
action_chains.move_by_offset(50, 0)
action_chains.perform()
EDIT: Here is html code of the element-
<input id="combobox-9822-inputEl" data-ref="inputEl" type="text" size="1" name="combobox-9822-inputEl" placeholder="Inserted" style="text-align:left;" aria-hidden="false" aria-disabled="false" role="combobox" aria-haspopup="true" aria-expanded="false" aria-owns="combobox-9822-inputEl combobox-9822-picker-listEl" aria-autocomplete="list" aria-invalid="false" aria-readonly="false" aria-describedby="combobox-9822-ariaStatusEl" aria-required="false" class="x-form-field x-form-empty-field x-form-empty-field-default x-form-text x-form-text-default " autocomplete="off" data-componentid="combobox-9822">
Here is the html for scrollbar:
<div class="x-grid-scrollbar x-scroller x-grid-scrollbar-visible" id="ext-element-38" style="overflow: scroll hidden; width: 749px; height: 17px; left: 0px;"><div class="x-scroller-spacer" role="presentation" id="ext-element-44" style="transform: translate3d(9623px, 0px, 0px); line-height: 1px;"></div></div>
What should i do?
This trick worked:
scroll = driver.find_element(By.XPATH,xpath)
webdriver.ActionChains(driver).move_to_element
(scroll).click(scroll).perform()
Just click the scrollbar,it takes you to the end of the page and then you can access the element. p.s: This is just a work around.