0
votes

I was trying to automate the control on a page, on where there is a iframe and an element that can be controlled with AutoIT. I need to click the Scan button within the iframe. I used driver.switch_to.frame("frmDemo") to switch frame, but it seemed not working. Any idea please?

Here is the code:

import win32com.client
import time
from selenium import webdriver

autoit = win32com.client.Dispatch("AutoItX3.Control")

# create a new Firefox session
driver = webdriver.Firefox()
driver.implicitly_wait(30)
driver.get("http://example.com")
time.sleep(2)
driver.switch_to.frame("frmDemo")
scanButton = driver.find_element_by_css_selector('body.input[type="button"]')
scanButton.click()
1

1 Answers

1
votes

input is not class, its child element of body. Try without body

scanButton = driver.find_element_by_css_selector('input[type="button"]')

You can also try by the value attribute

scanButton = driver.find_element_by_css_selector('value="Scan"')