I am trying to enter the number 1 into the MasterPack boxes within this table but get an error telling me it is not interactable.
My code looked like this and produced the element not interactable error
driver.find_element_by_xpath('//*[@id="asnPick_order_0_itemInfo_TABLE"]/div[1]/div/div/div/table/tbody/tr[1]/td[8]')
.send_keys("1")
The HTML for the table is here, I am trying to edit the MasterPack cell, so the line in between 125 and 1. The cell in the table I am trying to edit has no attributes and is blank. The text for the other cells is not listed under an attribute it is just there inbetween the tags.
<tr><td class="">0001</td>
<td class="">1022-0221-00</td>
<td class="">1004850854</td>
<td class="">8809490582667</td>
<td class="">19</td>
<td class="htAutocomplete">Each<div class="htAutocompleteArrow"> </div></td>
<td class="">125</td>
<td class=""></td>
<td class="">1</td>
<td class="htAutocomplete">Each<div class="htAutocompleteArrow"> </div></td>
<td class="">D480 3-STAGE TRUE HEPA AIR PURIFIER</td>
<td class=""><a class="no-border" title="Delete"><i class="fa fa-trash-alt fa-lg" aria-hidden="true"> </i><div class="screen-reader-only">Delete</div></a></td></tr>
I found that I can successfully click on the box using
driver.find_element_by_xpath('//*[@id="asnPick_order_0_itemInfo_TABLE"]/div[1]/div/div/div/table/tbody/tr[1]/td[8]').click()
I believe this is a dynamic table because When I click on any cell it changes the HTML to show the class = "current highlight" I have a line of code that successfully clicks on the master pack cell. The element not intractable error occurs when I try to send keys I need to figure out how to edit the numbers without a tag, for example here is the html of another cell that already had text in it.
<td class="">8809490582667</td>
I need to edit those numbers, but in the master pack cell where its blank without getting a element not interactable error.
Here is the html from after I click the master pack box, I don't think clicking it is necessary to enter text but then again, I don't know.
<tr><td class="">0001</td>
<td class="">1022-0221-00</td>
<td class="">1004850854</td>
<td class="">8809490582667</td>
<td class="">19</td>
<td class="htAutocomplete">Each<div class="htAutocompleteArrow"> </div></td>
<td class="">125</td>
<td class="current highlight"></td>
<td class="">1</td>
<td class="htAutocomplete">Each<div class="htAutocompleteArrow"> </div></td><td class="">D480 3-STAGE TRUE HEPA AIR PURIFIER</td><td class=""><a class="no-border" title="Delete"><i class="fa fa-trash-alt fa-lg" aria-hidden="true"> </i><div class="screen-reader-only">Delete</div></a></td></tr>
Any ideas on how to use execute script, setAttribute, or send keys to enter numbers into these td Master Pack boxes?
UPDATE: I was able to temporarily enter numbers into the box using this code
driver.find_element_by_xpath(
'//*[@id="asnPick_order_0_itemInfo_TABLE"]/div[1]/div/div/div/table/tbody/tr[1]/td[8]').click()
element = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.XPATH, "//table[@class='htCore']//tbody/tr//td[contains(@class, 'highlight')]")))
driver.execute_script('arguments[0].innerHTML = "1"', element)
When this code runs, it correctly places the number one into the box. However, that number one disappears after I click the next button to save the page. I seems like I am only changing the appearance of this form not actually editing the box because it disappears. Why would editing the innerHTML only be temporary? Any ideas on how to keep the 1 from disappearing or permanently edit/send the key to the html? Thanks
Here is the html for after the number 1 is added.
<td class="current highlight">1</td>