2019-03-09  1,215 views 发表评论

Python+selenium操作Chrome浏览器,定时执行观看adblast.org的广告任务

 标签:

参考:https://www.cnblogs.com/drake-guo/p/6188366.html

近期测试一个项目adblast.org,需要每日定时观看10个广告包记录。这种事情,当然不能要自己真的来观看广告任务了,需要借助上面的脚本,自动执行就好了。

脚本:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

# https://chromedriver.storage.googleapis.com/index.html?path=2.26/
driver = webdriver.Chrome()

def main(username, password):
    driver.get("https://adblast.alternet.com/auth")
    assert "AdBlast" in driver.title
    elem_user = driver.find_element_by_name("email")
    elem_user.clear()
    elem_user.send_keys(username)

    elem_password = driver.find_element_by_name("password")
    elem_password.clear()
    elem_password.send_keys(password)

    # action login
    time.sleep(10)
    elem_user.send_keys(Keys.RETURN)

    assert u"有资格" in driver.page_source
    





    # assert "No results found." not in driver.page_source
    # driver.close()


if __name__ == "__main__":
    main("username", "password")

 

 

 

 

(2019-07-19)测试结束,骗子项目。😂

给我留言

您必须 登录 才能发表留言!