2

How can I access embedded part from web page and contents using selenium and python

<embed src="RainPastDailyMonth.php" width="100%" height="100%">

Embedded part has input button elements which I need to access using selenium but getting

Message: no such element: Unable to locate element: 

{"method":"xpath","selector":"/html/body/center/b/input"} 

for below code

driver.find_element(By.XPATH, '/html/body/center/b/input')

where '/html/body/center/b/input' is XPATH for input button

2 Answers2

2

I am able to access the elements in an <embed> block by switching frame to <embed> element.

driver.switch_to.frame(driver.find_element(By.CSS_SELECTOR, 'body > embed'))

Here, 'body > embed' is selector for <embed> element.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
-2

You cannot.

The <embed> element creates an embedded panel in which a third-party application can run. In other words: it is outside of the DOM. Selenium is able to operate only on items in the browser's DOM.

You will need to access this third-party application using some other means. AutoIT or Sikuli are popular options.

SiKing
  • 10,003
  • 10
  • 39
  • 90