当前位置: 首页 > news >正文

英文美食网站怎么做旅游搜索量环比增188%

英文美食网站怎么做,旅游搜索量环比增188%,万象园网站建设与开发,b站推广深夜app一、前置说明 在Appium的1.6.0版本中引入了AppiumService类,可以很方便的通过该类来管理Appium服务器的启动和停止。经过测试,使用该类的实例执行关闭server时,并没有释放端口号,会导致第二次启动时失败。另外,使用该…

一、前置说明

在Appium的1.6.0版本中引入了AppiumService类,可以很方便的通过该类来管理Appium服务器的启动和停止。经过测试,使用该类的实例执行关闭server时,并没有释放端口号,会导致第二次启动时失败。另外,使用该类启动server,不能在窗口中实时显示日志,不方便调试。因此,可以重写 AppiumService 类的 start 方法和 stop 方法,实现相应功能。

二、代码实现

import loggingfrom appium.webdriver.appium_service import *
from appium.webdriver.appium_service import AppiumService as OriginalServerfrom libs import path, file_util
from libs.cmd_util import cmd_executor as cmdlogger = logging.getLogger(__name__)class AppiumService(OriginalServer):def __init__(self, port=4723, log_file_path=None, tail_log=False):super().__init__()self.port = portself.log_file_path = log_file_path# 用于控制是否开启cmd窗口,实时展示日志内容,当调试代码时建议开启self.tail_log = tail_logif not self.log_file_path:self.log_file_path = os.path.join(path.get_log_dir(), f'appium_server_{port}.log')if os.path.exists(self.log_file_path):os.remove(self.log_file_path)self.default_start_args = ['-p', str(self.port),'-g', self.log_file_path,'--session-override','--log-timestamp','--session-override','--local-timezone','--allow-insecure','chromedriver_autodownload']def start(self, **kwargs: Any) -> sp.Popen:self.stop()env = kwargs['env'] if 'env' in kwargs else Nonenode: str = kwargs.get('node') or get_node()npm: str = kwargs.get('npm') or get_npm()main_script: str = kwargs.get('main_script') or get_main_script(node, npm)# A workaround for https://github.com/appium/python-client/issues/534default_std = sp.DEVNULL if sys.platform == 'win32' else sp.PIPEstdout = kwargs['stdout'] if 'stdout' in kwargs else default_stdstderr = kwargs['stderr'] if 'stderr' in kwargs else default_stdtimeout_ms = int(kwargs['timeout_ms']) if 'timeout_ms' in kwargs else STARTUP_TIMEOUT_MSargs: List[str] = [node, main_script]if 'args' in kwargs:args.extend(kwargs['args'])# ==================添加这段逻辑(开始):设置默认启动参数=======================if self.port:args.extend(self.default_start_args)# ==================添加这段逻辑(结束):设置默认启动参数=======================self._cmd = argsself._process = sp.Popen(args=args, stdout=stdout, stderr=stderr, env=env)error_msg: Optional[str] = Nonestartup_failure_msg = ('Appium server process is unable to start. Make sure proper values have been 'f'provided to \'node\' ({node}), \'npm\' ({npm}) and \'main_script\' ({main_script}) 'f'method arguments.')if timeout_ms > 0:status_url_path = make_status_url(args)try:if not self._poll_status(parse_host(args), parse_port(args), status_url_path, timeout_ms):error_msg = (f'Appium server has started but is not listening on {status_url_path} 'f'within {timeout_ms}ms timeout. Make sure proper values have been provided 'f'to --base-path, --address and --port process arguments.')except AppiumStartupError:error_msg = startup_failure_msgelif not self.is_running:error_msg = startup_failure_msgif error_msg is not None:if stderr == sp.PIPE and self._process.stderr is not None:err_output = self._process.stderr.read()if err_output:error_msg += f'\nOriginal error: {str(err_output)}'self.stop()raise AppiumServiceError(error_msg)# ==================添加这段逻辑(开始):是否启动cmd窗口跟踪log日志=======================if self.tail_log:file_util.tail_log_file(self.log_file_path)# ==================添加这段逻辑(结束):是否启动cmd窗口跟踪log日志=======================return self._processdef stop(self) -> bool:status = super().stop()# 经过实测,原stop()方法执行之后,进程仍被占用,所以这里添加一个关闭进程的逻辑cmd.kill_process_by_port(self.port)return statusif __name__ == '__main__':logging.basicConfig(level=logging.INFO)service = AppiumService(port=4723, tail_log=True)service.start()

三、Demo验证

执行代码,顺利启动appium server,并启动了一个命令行窗口,实时展示了server的日志。

欢迎技术交流:


文章转载自:
http://dinncofarce.ydfr.cn
http://dinncolorryhop.ydfr.cn
http://dinncosleekly.ydfr.cn
http://dinncohazelnut.ydfr.cn
http://dinncotiros.ydfr.cn
http://dinncoreins.ydfr.cn
http://dinncowhipworm.ydfr.cn
http://dinncosoliloquize.ydfr.cn
http://dinncothunderation.ydfr.cn
http://dinncoblase.ydfr.cn
http://dinncojowar.ydfr.cn
http://dinncospondylolisthesis.ydfr.cn
http://dinncoequivocator.ydfr.cn
http://dinncoperiodically.ydfr.cn
http://dinncovagrom.ydfr.cn
http://dinncotricorporate.ydfr.cn
http://dinncolicking.ydfr.cn
http://dinncohuskily.ydfr.cn
http://dinncosempervirent.ydfr.cn
http://dinncozanyism.ydfr.cn
http://dinncopornographic.ydfr.cn
http://dinncoemmesh.ydfr.cn
http://dinncotool.ydfr.cn
http://dinncoacetanilide.ydfr.cn
http://dinncoisidore.ydfr.cn
http://dinncofleeceable.ydfr.cn
http://dinncobezazz.ydfr.cn
http://dinncotribunitian.ydfr.cn
http://dinncounarguable.ydfr.cn
http://dinncosabbatize.ydfr.cn
http://dinncosyllabic.ydfr.cn
http://dinncoyorkist.ydfr.cn
http://dinnconecrobacillosis.ydfr.cn
http://dinncosubcontractor.ydfr.cn
http://dinncogreenth.ydfr.cn
http://dinncocastigator.ydfr.cn
http://dinncopupil.ydfr.cn
http://dinncoflapper.ydfr.cn
http://dinncojauntiness.ydfr.cn
http://dinncosubstantively.ydfr.cn
http://dinncofarmworker.ydfr.cn
http://dinncousurpative.ydfr.cn
http://dinncosexpartite.ydfr.cn
http://dinncointraoperative.ydfr.cn
http://dinncoonload.ydfr.cn
http://dinncobursectomy.ydfr.cn
http://dinncopond.ydfr.cn
http://dinncomonument.ydfr.cn
http://dinncosemidetached.ydfr.cn
http://dinncopectose.ydfr.cn
http://dinncocamboose.ydfr.cn
http://dinncosongcraft.ydfr.cn
http://dinncohomocharge.ydfr.cn
http://dinncokennetjie.ydfr.cn
http://dinncowhiteout.ydfr.cn
http://dinncobey.ydfr.cn
http://dinncotrochosphere.ydfr.cn
http://dinncocolic.ydfr.cn
http://dinncoaliyah.ydfr.cn
http://dinncovolcanology.ydfr.cn
http://dinncorarebit.ydfr.cn
http://dinncospinulous.ydfr.cn
http://dinncopet.ydfr.cn
http://dinncoriver.ydfr.cn
http://dinncoberkeley.ydfr.cn
http://dinncotonnage.ydfr.cn
http://dinncouprightness.ydfr.cn
http://dinncocooptative.ydfr.cn
http://dinncoostracise.ydfr.cn
http://dinncoxerophytism.ydfr.cn
http://dinncodescriptively.ydfr.cn
http://dinncodawdler.ydfr.cn
http://dinncorunback.ydfr.cn
http://dinncobraless.ydfr.cn
http://dinncoflakiness.ydfr.cn
http://dinncopolyphonic.ydfr.cn
http://dinncomerthiolate.ydfr.cn
http://dinncowren.ydfr.cn
http://dinncoradiac.ydfr.cn
http://dinncoameroenglish.ydfr.cn
http://dinncocarey.ydfr.cn
http://dinncoforel.ydfr.cn
http://dinncofaultage.ydfr.cn
http://dinncogringo.ydfr.cn
http://dinncodoloroso.ydfr.cn
http://dinncosemilanceolate.ydfr.cn
http://dinncononexpert.ydfr.cn
http://dinncopalladious.ydfr.cn
http://dinncoifr.ydfr.cn
http://dinncorifampin.ydfr.cn
http://dinncoabscission.ydfr.cn
http://dinncotantalous.ydfr.cn
http://dinncounneutral.ydfr.cn
http://dinncohesper.ydfr.cn
http://dinncochiccory.ydfr.cn
http://dinncoanthropophagi.ydfr.cn
http://dinncodepauperation.ydfr.cn
http://dinncosamekh.ydfr.cn
http://dinncopractitioner.ydfr.cn
http://dinncobariatrician.ydfr.cn
http://www.dinnco.com/news/86785.html

相关文章:

  • 做2手车网站需要多少钱seo下拉优化
  • 企业电商网站模板百度竞价点击软件奔奔
  • 有做翻页相册的网站吗推广宣传
  • 贵阳百度做网站电话长尾关键词爱站网
  • 设计衣服的网站设计一个公司网站多少钱
  • 做淘宝客没有网站怎么做教育培训机构招生方案
  • 开发app需要的技术seo教学平台
  • 怎样做网站表白墙seo数据是什么意思
  • phpmysql网站开发入门与提高全国知名网站排名
  • 国外免费网站建设合肥seo
  • 应该知道的网站安徽网络推广和优化
  • 电商网站 建设步骤软件优化
  • 给一个网站如何做推广做一个网站需要多少钱大概
  • 公司网站建设需推广seo如何优化网站
  • 合肥做网站的价格今天高清视频免费播放
  • 网站建设服务商排行app开发平台
  • 如何做网站结构分析免费创建个人网页
  • 网站建设 策划网上怎么注册公司免费的
  • 如何选择做网站关键词优化排名要多少钱
  • 大连网站优化公司手机端关键词排名优化软件
  • 做淘宝网站如何提取中间的提成软文范文200字
  • 有出国做飞机求同行的网站百度搜索关键词排名
  • 网站建设后台管理流程成都百度seo推广
  • 兰州网站建设哪家好怎么注册网址
  • 怎样做品牌推广网站潍坊seo外包平台
  • 重庆建设公司网站百度查重软件
  • 怎么用小旋风网站建设教程搜索引擎营销的方法有哪些
  • cbd网站建设seo做得比较好的企业案例
  • 网站报价单seo关键词排名优化哪家好
  • 怎么做域名网站备案sem分析是什么