Why do i keep getting break error? I have the same problem with continue and pass

39 views Asked by At
from webbot import Browser
import time
import pyautogui
from pyautogui import *
web = Browser()
a == True
web.go_to('http://au.yahoo.com//')
web.scrolly(100)
if a == True:
    try:
        web.click('Skip for now')
        break
web.click('Mail')
time.sleep(10)
pyautogui.keyDown('ctrl')

break keeps coming up with unexpected error

I want it to try click 'skip for now', if not then continue the code

2

There are 2 answers

2
Diogo On BEST ANSWER
try:
    web.click("Skip for now")
except:
    pass
0
Apo On
web = Browser()
a == True
web.go_to('http://au.yahoo.com//')
web.scrolly(100)
if a == True:
    try:
        web.click('Skip for now')
    except:
        pass
web.click('Mail')
time.sleep(10)
pyautogui.keyDown('ctrl')

EDIT : miss spell of except