[PYTHON] How to manipulate the DOM in an iframe with Selenium

In the comment, you pointed out that it is driver.switch_to.frame (iframe). I haven't used Selenium recently and haven't confirmed it properly, but please refer to the comments you received as appropriate.

Note. Original story.

In Selenium, I take out a specific DOM element through the driver instance and click a button, but the DOM in the iframe is inaccessible as it is.

If you search for the DOM of the iframe first and call switch_to_frame of the driver, you can tamper with the DOM of that iframe.

iframe = driver.find_element_by_css_selector('.some-selector')
driver.switch_to_frame(iframe)
driver.find_element_by_css_selector('.some-selector-in-iframe').click()

Recommended Posts

How to manipulate the DOM in an iframe with Selenium
How to intentionally issue an error in the shell During testing
How to know the internal structure of an object in Python
How to create a heatmap with an arbitrary domain in Python
[Python] Explains how to use the format function with an example
How to work with BigQuery in Python
Operate Paints Chainer with Selenium to automatically color images in the directory
How to get the date and time difference in seconds with python
[Python] How to set the (client) window size inside the browser with Selenium
How to deal with memory leaks in matplotlib.pyplot
How to use the C library in Python
Log in to the remote server with SSH
[REAPER] How to play with Reascript in Python
How to specify the NIC to scan with amazon-dash
How to try the friends-of-friends algorithm with pyfof
How to deal with run-time errors in subprocess.call
How to deal with SessionNotCreatedException when using Selenium
How to read an array with Python's ConfigParser
Log in to Yahoo Business with Selenium Python
How to get the files in the [Python] folder
How to use tkinter with python in pyenv
How to Learn Kaldi with the JUST Corpus
How to pass the path to the library built with pyenv and virtualenv in PyCharm
How to display in the entire window when setting the background image with tkinter
To automatically send an email with an attachment using the Gmail API in Python
How to get a list of files in the same directory with python
How to debug selenium
I tried to explain how to get the article content with MediaWiki API in an easy-to-understand manner with examples (Python 3)
How to create an article from the command line
How to retrieve the nth largest value in Python
How to convert / restore a string with [] in python
How to delete the specified string with the sed command! !! !!
How to get the number of digits in Python
How to do hash calculation with salt in Python
[Introduction to Python] How to iterate with the range function?
How to know the current directory in Python in Blender
Explain in detail how to make sounds with python
How to create a submenu with the [Blender] plugin
How to deal with pyenv initialization failure in fish 3.1.0
How to do zero-padding in one line with OpenCV
How to run tests in bulk with Python unittest
Convert the image in .zip to PDF with Python
I was addicted to scraping with Selenium (+ Python) in 2020
How to use the exists clause in Django's queryset
How to make an interactive CLI tool in Golang
How to download files from Selenium in Python in Chrome
How to make an HTTPS server with Go / Gin
How to create an image uploader in Bottle (Python)
How to use the model learned in Lobe in Python
[Python] How to rewrite the table style with python-pptx [python-pptx]
I can't manipulate iframes in a page with Selenium
[Python] How to output the list values in order
How to switch to smartphone mode with Python + Selenium + Chrome
How to deal with Executing transaction: failed in Anaconda
[Selenium] How to specify the relative path of chromedriver?
How to operate Firefox with selenium on Windows Memo
How to set a shared folder with the host OS in CentOS7 on VirtualBOX
How to identify the element with the smallest number of characters in a Python list?
How to start the code written in Atom with one command without starting teminal
[Note] How to write QR code and description in the same image with python
How to count the number of occurrences of each element in the list in Python with weight