Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Selenium xpath finding gif to click
#1
I am having trouble with clicking all buttons that are defined as animation format (.gif) in a website. I use 'xpath' in selenium to find these buttons with their ids but the script doesn't continue at this line. How can I click all these buttons by finding all gifs? My script is that:
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait


driver = webdriver.Firefox(executable_path=r'D:\geckodriver.exe')
driver.get("http://svtbilgi.dsi.gov.tr/Sorgu.aspx")
driver.find_element_by_id("ctl00_hld1_cbHavza").click()
Select(driver.find_element_by_id("ctl00_hld1_cbHavza")).select_by_visible_text("15. Kizilirmak Havzasi")
driver.find_element_by_id("ctl00_hld1_cbHavza").click()
driver.find_element_by_id("ctl00_hld1_btnListele").click()
parent_handle = driver.current_window_handle
all_urls = []
all_images = driver.find_elements_by_xpath("//div[contains(@id,'OL_Icon')]/img")
for image in all_images :
     image.click()
     for handle in driver.window_handles :
          if handle != parent_handle:
              driver.switch_to_window(handle)
              WebDriverWait(driver, 15).until(lambda d: d.execute_script('return document.readyState') == 'complete')
              all_urls.append(driver.current_url)
              driver.close()
              driver.switchTo.window(parent_handle)
Quote
#2
Hmm what a terribly design and look that site has Sick
Did a quick test.
Look like all those green dot interfere when selenium shall click on one.
Did not test anymore,can search for ElementClickInterceptedException to see if someone has a solution.
fyec likes this post
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Python Selenium .click() Loads Error - Works Manually.- Events not Triggered NSearch 24 1,064 Aug-14-2019, 02:23 PM
Last Post: NSearch
  Selenium click on popup button??? GuJu 7 974 Jul-20-2019, 09:21 AM
Last Post: Nizam
  Click Element if displayed using Selenium and Python giaco__mar 1 689 Dec-27-2018, 06:19 PM
Last Post: metulburr
  Selenium chromedriver and click action Gilles95 4 6,499 Feb-07-2018, 07:28 PM
Last Post: Gilles95
  Error in Selenium: CRITICAL:root:Selenium module is not installed...Exiting program. AcszE 1 1,020 Nov-03-2017, 08:41 PM
Last Post: metulburr
  Click dropdown menu option with Selenium PyChrome AcszE 3 2,237 Oct-26-2017, 10:07 PM
Last Post: metulburr
  Click on a Drop-down button with selenium Python AcszE 3 3,021 Oct-25-2017, 03:13 PM
Last Post: vardhhan
  Click in the (…) icon in youtube with selenium PyChrome AcszE 6 4,301 Oct-19-2017, 02:45 AM
Last Post: snippsat
  [Selenium] Xpath Drop Down Use Variable digitalmatic7 3 1,638 Oct-07-2017, 01:45 PM
Last Post: buran
  selenium click a span tag metulburr 1 11,216 Nov-30-2016, 05:47 PM
Last Post: snippsat

Forum Jump:


Users browsing this thread: 1 Guest(s)