Python+selenium 's cut-in and cut-out of iframe
Problem found: when logging in to the http://www.126.com automated test, the login name and password can not always be located. It is not possible to use class,xpath,id,css and other methods. Later, after a closer look, I found that the login embedded, that is, iframe, so it has to be cut in order to locate to the element.
Solution:
1. First of all, for the embedded html of iframe, use switch_to.frame to cut into the iframe to get the elements.
two。 When you want to get the external elements of iframe, cut out the iframe with switch_to_default_content (). If you do not cut out, printing with print will report a "dead object" error because the iframe has not been cut out yet.