zTomX
zTomX

Reputation: 11

Selenium, how to find this element

enter image description here

I need to find the webelements like id="rcmrowgeneral".

A standard driver.find_element_by_id() is not working. It's like they are inside another HTML page. How can I find them with selenium to interact with them?

Upvotes: 1

Views: 59

Answers (2)

Mate Mrše
Mate Mrše

Reputation: 8444

Your element is inside of an iframe. First you need to switch to the iframe and then it is a good practice to wait for the element to be visible/clickable before interacting with it.

driver.switch_to().frame(driver.find_element_by_id("TiscaliWebmailFrame"))
WebDriverWait(driver, 20).until(expected_conditions.presence_of_element_located((By.ID, "rcmrowgeneral"))).click()

Upvotes: 0

Hassaan Ali
Hassaan Ali

Reputation: 1061

You can do this by following the selenium syntax which states if you want to find a specific tag inside an iframe you have to switch to that iframe first and then you can use selenium query to find it. Since you've not posted any code over here i assume you've background knowledge of handling automation processes. You can do this task by following this naming convention:

driver.switchTo().frame("id or name of the element")
driver.find_element_by_id("your id here")

Upvotes: 2

Related Questions