I was facing issues while getting the text from my elements and getting some issues while trying to get value of hidden elements, so I tried to use key down to make hidden elements visible and then get the text from it.
I have been trying to navigate to the rows of a table using the arrow_down key but its not working even after trying multiple options.
my html file structure is like:
<table class="activities-table">
<thead style="display:none">
<tbody>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
I have elements corresponding to each .
Things that I tried so far:
1.
elem_list = self.elements
elem = elem_list[0] #took the first element
actions = ActionChains(driver)
actions.click(elem).send_keys_to_element(elem,Keys.SPACE ).perform()
2.
elem_pos = elem.location['y']
driver.execute_script("window.scroll(0, %s)"%elem_pos)
elem.click()
time.sleep(2)
elem.send_keys(Keys.ARROW_DOWN)
3.
elem_list = self.elements
elem = elem_list[0]
elem.click()
elem.send_keys(Keys.ARROW_DOWN)
Every time the click works but send_keys is executed without performing any action.
Solved above problem with following.
elem1 below is the element of the table scroller:
elem1 = driver.find_element_by_xpath(<xpath of the table scroller>)
actionChains = ActionChains(driver);
numberOfPixels = 50;
actionChains.move_to_element(elem1).click_and_hold().move_by_offset(0,numberOfPixels).release().perform();
The number of pixels to be drag can be varied as per requirement
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With