简体   繁体   中英

(Selenium/Python) Tracking the code 200 after clicking on the element

Good day to all of you. Please help me with my headache. After I click on the button/field, etc. (via selenium), a request is sent (which has the status "pending"). How can I track the status of 200 before selenium moves to the next field ? (if this moment does not track, it aborts the previous request, and the entry in the previously entered field is deleted). Thank you in advance!) Visual example

This is not possible/supported natively via selenium

you could use requests packages

something like this:

url = 'http://www.google.com'
driver.get(url)
status_code = requests.get(url).status_code

status = True
while status:
    if status_code != 200:
        print("Status code is not 200")
        time.sleep(3)
    else:
        print("status code is 200")
        status = False

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM