devtools-proxy
devtools-proxy copied to clipboard
Unable to switch to iframe
I am unable to switch context to iframe elements while using devtools-proxy. The same code works without using the proxy. Any ideas why this might be happening?
Sample code:
devtools_proxy_port = 9222
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--start-maximized')
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_argument('--disable-application-cache')
chrome_options.add_argument('--no-sandbox')
chrome_options.binary_location = CHROME_WRAPPER_PATH
chrome_options.add_argument('--chrome-binary=' + binary_location)
chrome_options.add_argument('--devtools-proxy-binary=devtools-proxy')
chrome_options.add_argument(f'--devtools-proxy-args=--port {devtools_proxy_port}')
driver = webdriver.Chrome(driver_path, chrome_options=chrome_options)
driver.set_page_load_timeout(page_load_timeout)
try:
driver.get('http://www.' + url_link)
devtools_client.main_func(url_link)
iframe_elements = driver.find_elements_by_tag_name('iframe')
driver.switch_to.frame(iframe_elements[0])
# Also tried with index, id but no luck
# driver.switch_to.frame(0)
# driver.switch_to.frame('iframe_id')
except Exception as e:
print('something went wrong.')
I am using Selenium 3.6, ChromeDriver 2.21, and Chromium. 48.
Hey @UmarIqbal, thanks for the report, I'll have a look at it.
@bayandin did you had a chance to look into it?
@UmarIqbal I have reproduced this bug but currently, have no idea how to fix it, there is no clue in chromedriver logs. I'll take a closer look when will get some free time, probably it'll be in the next week. Sorry about that.