Robex
Robex

Reputation: 47

Selenium cant click element

So recently I came across this error and get around it. I have selenium set up in a way that a user enters text and the search bar on https://www.dukascopy.com/trading-tools/widgets/quotes/historical_data_feed displays the data however I can't click the result with my code.the data i am trying to access

Upvotes: 0

Views: 156

Answers (1)

Wiggy A.
Wiggy A.

Reputation: 496

Here we go. The search bar needed to be toggled through a button click.

... # Driver initialization, navigating to the page etc.

# The first nested frame
frame_1 = driver.find_element_by_id("widget-container")
driver.switch_to.frame(frame_1)

# The second nested frame
frame_2 = driver.find_element_by_tag_name("iframe")
driver.switch_to.frame(frame_2)

# Toggling the search bar
driver.find_element_by_xpath("//div[contains(text(), 'Instrument')]").click()

# Actually sending in the query
search = driver.find_element_by_xpath("//input[@placeholder='Instrument']")
search.send_keys("Hey there!")

Upvotes: 2

Related Questions