Created
June 23, 2014 10:58
-
-
Save easonhan007/188ed2c856b64e1341cd to your computer and use it in GitHub Desktop.
python selenium中使用jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from selenium import webdriver | |
import time | |
import unittest | |
dr = webdriver.Chrome() | |
dr.get("http://192.168.10.21:28080/admin/tag/list.do") | |
jqueryPath = 'D:/jquery-1.7.1.js' | |
jqueryFile = open(jqueryPath) | |
jquery = jqueryFile.read() | |
jqueryFile.close() | |
js = '''$(".table_td:contains('APP Tag 1403513107.4')")[0].parentElement.children[2].children[0].click();''' | |
dr.execute_script(jquery+js) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment