The Problem
I'm trying to change the page of a database (ReferenceUSA, requires paid or university credentials) using selenium by typing the page number in and clicking enter, but the catch is that the search box is in a div tag. send_keys() only works for input and textarea tags. Here's a picture of the page navigator, and here's the HTML:
<div class="pager">
<div class="prev button" title="Hold down to scroll through records faster." style="float: left;">«</div>
<div class="page" style="text-align: center; margin: 0px 1em; float: left; width: 40px;">1</div>
<div class="next button" title="Hold down to scroll through records faster.">»</div><span style="clear: both;"></span></div>
My Attempt
I figured out how to change the innerHTML, so I really only need to hit enter on the div tag. I thought of and tried changing the innerHTML for the next button (e.g. set current page to 1207 in next_button() function if I wanted to navigate to page 1208), but the functions are all written in a global file for the site, thousands of lines long, and they all feed off each other using the same 6 variables making it essentially unreadable. I've brought this problem to one of my CS professors to no avail.
There must be a simple solution, but I'm at a loss right now. I would greatly appreciate it if anyone could offer some guidance
sendKeysworks only oninputandtextarea, what error are you getting when you usesendKeysondiv?start_page = driver.find_element_by_xpath(XPATH) driver.execute_script('arguments[0].innerHTML = "1207";', start_page) start_page.send_keys(Keys.RETURN)