当我将cli参数传递为:'python auto_refresh.py -web_address https://stackoverflow.com/']时,出现此错误>
错误显示为:
Traceback (most recent call last): File "auto_refresh.py", line 14, in <module> option=get_arguments() File "auto_refresh.py", line 8, in get_arguments option = args.parse_arg() AttributeError: 'ArgumentParser' object has no attribute 'parse_arg'
'''
import time from selenium import webdriver import argparse def get_arguments(): args = argparse.ArgumentParser() args.add_argument("-w","-- web_address",dest="web_address",help= "enter web_address") option = args.parse_arg() if not option.web_address: parser.error("[-] please specify web address, use --help for more info") else : return args option=get_arguments() driver= webdriver.Chrome() driver.get(option.web_address) while true: time.sleep(3) driver.refresh() time.sleep(2) driver.close()
'''
在此脚本中运行并传递cli参数的可行解决方案是什么?有什么帮助吗?
当我将cli参数传递为:'python auto_refresh.py -web_address https://stackoverflow.com/'时,出现此错误,显示为:Traceback(最近一次调用为最新):文件“ auto_refresh.py”, ...