1. Problem description
I recently wrote a case of automatic login, there is a process to crack the sliding verification code, but when locating the element on the sliding verification code, I always prompt that the corresponding element cannot be located, and the error is as follows:
Unable to locate element: {"method":"xpath","selector":"//div[@class='show-code']/input"}
When I first opened, I thought that the positioning method was wrong. I tried xpath positioning and id / name positioning, but it still reported an error; I later thought it was caused by a network delay problem, so I added a delay time.sleep () before positioning.
But after trying it, no matter how long the home is delayed, there is still a problem; the biggest reason for the next thought may be that the page does not jump to the verification code pop-up page, and then carefully read the next page code and found the verification code pop-up A frame, and another page is actually embedded in the frame, and the webdriver can only be recognized on one page at a time, so you need to first locate the corresponding frame to locate the elements on that page. This problem also made me have a headache for a long time, and finally solved it, happy.