python基于phantomjs实现导入图片

WBOY
Release: 2016-06-10 15:04:45
Original
1287 people have browsed it

基于的phantomjs的自动化,会出现

1.flash不支持

2.部分基于view的按钮点不到,部分按钮是基于flash的(尤其是在于上传按钮)

browser.find_element_by_xpath(".//*[@name='SWFUpload_0']").click()  #点击上传按钮
sleep(2)
autoit.control_set_text("", "[CLASS:Edit; INSTANCE:1]",tupian )  #上传图片链接
sleep(0.5)
autoit.send("{TAB}{TAB}{ENTER}")  #点击确定
 
# 以上为操作有界面的浏览器的方法. webdriver 
 
browser.execute_script("document.getElementById(\"input_upload_image1\").type='text';")       #正常flash操作上传,都会存在一个input框,但正常都会是 hidden,可以通过js将其显示出来
browser.find_element_by_xpath(".//*[@id='input_upload_image1']").send_keys('*********') #上传链接
 
browser.find_element_by_xpath(".//*[@id='pub_submit']").click() 
Copy after login

以上就是本文的全部内容了,希望对大家学习使用phantomjs能够有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!