优艾设计网

Mac下crontab 无法执行selenium?

优艾设计网 https://www.uibq.com 2023-04-18 14:06 出处:网络 作者:PS教程自学
#-*- coding: UTF-8 -*-#!/usr/bin/env python print(\"test - 1\") import s优艾设计网_设计百科ys from selenium import webdriver print(\"test - 2\") url = \"http://XXX.com/\" driver = webdriver.Firefox()d

#-*- coding: UTF-8 -*-#!/usr/bin/env python print("test - 1") import s优艾设计网_设计百科ys from selenium import webdriver print("test - 2") url = "http://XXX.com/" driver = webdriver.Firefox()driver.get(url+ "/") driver.find_element_by_xpath("//div[2]/input").send_keys("XXX") driver.find_element_by_xpath("//div[3]/input").send_keys("XXX") driver.find_element_by_id("loginButton").click() driver.find_element_by_css_selector("a > img").click()driver.quit()

代码如上图
crontab 配置:

export DISPLAY=:0.0 &&python /Users/l/Downloads/phantomjs-2.1.1-macosx/bin/release-day/test.py>> /Users/l/Downloads/log

输出结果为:

test - 1

请教是什么问题?解决方案是什么?


0

精彩评论

暂无评论...
验证码 换一张
取 消