In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
No matter how proficient you are in selenium, the most important thing that accompanies testers is positioning.
The first pit:
For the page to be located, there is html nesting, that is, ifrmae. You can find this intuitively on the html code page. In fact, a sub-page is referenced in a page. As a result, we can't find the element directly when we use xpath or css to locate. At this time, we need to use a new thing to locate her, the general idea is: the first step is to switch from the parent page to the child page; the second step is to locate the elements in the child page; and the third step is to return to the parent page (this depends on personal needs. Specific where to stay needs to be combined with reality).
The implementation of the first step requires one method: switch_to_frmae. For specific usage, please refer to the code. Here, I must remind you that switch_to_frmae may not work because of version problems, which may need to be changed to switch_to.frmae. One'_', one'. I've been climbing this hole for a long time.
The second step is relatively simple. We can copy the xpath or css path with firebug. It is worth noting that this time the path starts from the child page, has nothing to do with the parent page, if you want to use id,class and so on, it should be possible (of course, I have not tried, I am not responsible for this sentence).
The third step, return, we need to exit when we don't need to locate in this sub-page, which requires a new method.
Switch_to.default_content (). The specific content can be Baidu or refer to my code map. At this point, the first pit jumped out. When positioning elements, be sure to pay attention to element or elements, a singular, a plural, the meaning is really too big difference. When you find_element_by_id ('p') is just an id ='p' element, find_elements_by_id ('p') is actually a list of id ='p'. Remember that you want one or more elements, and remember. The code I posted was a problem when I tested the account password to log in to QQ Mail. This time, the problem is not the code, but it may be due to the network or some other reason. When I located QQ Mail's' login 'button, click () kept showing the word "server busy". At first, I thought it was clicked too fast, and this was still the case after I set time.sleep (3) (invisible waiting I didn't try. But interested students can try), in order to solve this problem, I have no choice but to click (), then time.sleep (3), and then click (), unexpectedly miraculously successful.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.