Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Python+selenium 's cut-in and cut-out of iframe

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report