What my code is trying to do is to find a set of elements then click on each element at which point a tooltip message is displayed. Click on a link in the tootip message which will take the user to a different page then do some activity there and navigate back to the previous page then click on the second element and click on the link in the tooltip message for the second element.
For some reason my code is only clicking on the link in the tool tip message for the second time. Next time its unable to find the link in the tooltip message to click on. Can someone please please help? I have tried different things but nothing worked. Please find below the code that I wrote:
I am using Python and Selenium
elements = driver.find_elements_by_css_selector("#top-tables-chart-container > div > svg > g > g > rect")
counter = 0
for counter in range(counter, len(elements)):
elements = driver.find_elements_by_css_selector("#top-tables-chart-container > div > svg > g > g > rect")
webdriver.ActionChains(driver).move_to_element(elements[counter]).click().perform()
time.sleep(5)
tableNameLink= elements[counter].find_element_by_xpath("//div[@class='d3-tip bar-chart top-tables-tooltip n']//div[@class='left-section']//div[@class='table-name']//a[contains(@href,'#/table/')]")
print tableNameLink
tableNameLink.click()
tableName = driver.find_element_by_xpath("//div[@class='discover-design-transform-container clearfix']//div[@class='left-header-section clearfix']//div[@class='entity-info table-type']//span[@class='entity-identifier']")
table = tableName.text
print " Table: " + table
print '\n'
if table == "lineitem":
TableAccessFreqChartInfoBadgesValidation(self.driver).test_table_access_freq_chart_info_badges_validation("F","8","13","13")
time.sleep(1)
print '\n'
if table == "orders":
TableAccessFreqChartInfoBadgesValidation(self.driver).test_table_access_freq_chart_info_badges_validation("D","4","9","9")
time.sleep(1)
print '\n'
topUsagePatternsTab = driver.find_element_by_xpath("//div[@id='workload-level-tabs']//a[@href='#/topUsagePatterns']")
topUsagePatternsTab.click()