Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98814

ActionsChains says my Xpath is out of bounds of viewport width and height [duplicate]

$
0
0

Hello

My problem is pretty much explained in the title, I am trying to right click and open in a new tab (I really need it to be done that way) each of the likers of a specific instagram post and while chromium doesn't seem to have any trouble finding an individual user with my xpath and you surely will be able to see it, my bot on the other hand, gives me this error:

selenium.common.exceptions.MoveTargetOutOfBoundsException: Message: (625, 731) is out of bounds of viewport width (1280) and height (709)

As you will see in the picture posted below, we can clearly see the user.

Here's the code:

My class inherits from the webdriver classes, which is why you'll see self.find_element_by_xpath() instead of self.driver.find_element_by_xpath()

num = len(self.find_elements_by_xpath("//div[contains(@style, 'height: 356px; overflow: hidden auto;')]/div/div"))
   for i in range(1, num):
       try:
           tab_1 = self.current_window_handle
           user  = self.find_element_by_xpath("//div[contains(@style, 'height: 356px; overflow: hidden auto;')]/div/div["+str(num)+"]/div[2]/div[1]"
           ActionChains(self).move_to_element(user).key_down(Keys.CONTROL).click(user).key_up(Keys.CONTROL).perform()

           tab_2 = self.window_handles[1]
           self.switch_to.window(tab_2)

And here's a picture of the thing I'm trying to open in a new tab:

enter image description here

Can you help me please?


Viewing all articles
Browse latest Browse all 98814

Trending Articles