今天一个朋友问我问题



考虑了下直接上代码,这是伪代码不能执行,但是给出了思路



代码

url = 'http://www.qingmiaokeji.cn/test.js'
res = urllib.request.urlopen(url=url)
js_source = res.read().decode('utf-8')
driver.execute_script(js_source)

更多精彩内容请访问 个人博客[程序猿和媛]

selenium webdriver执行远程 第三方js解决方案的更多相关文章

  1. xss 加载远程第三方JS

    script 没有调用远程平台,用web接收cookie <script>window.open('http://xxx.xxx/cookie.asp?msg='+document.coo ...

  2. 转:selenium webdriver 执行javascript代码

    在用selenium webdriver 编写web页面的自动化测试代码时,可能需要执行一些javascript代码,selenium本身就支持执行js,我们在代码中import org.openqa ...

  3. selenium webdriver ——执行javascript代码

    在代码中import org.openqa.selenium.JavascriptExecutor;就可以使用executeScript.executeAsyncScript这两个方法了 execut ...

  4. selenium,webdriver 执行js语句 对象是百度

    代码要多敲 注释要清晰 最后的两种方法,没有实现我想要的结果 有知道的朋友,给我留言吧 #执行js语句 from selenium import webdriver import time #生成浏览 ...

  5. 解决Selenium Webdriver执行测试时,每个测试方法都打开一个浏览器窗口的问题

    虽然把WebDriver定义为一个静态变量了,但是每次执行测试都要打开多个窗口,挺浪费时间的. 找了很多中方法,比如使用setUpClass, BeforeSuite都没有完全解决问题.后来无意间发现 ...

  6. selenium webdriver 执行Javascript

    @Test public void testElementByID() { //通过JS获取页面元素 driver.get(url); driver.manage().window().maximiz ...

  7. 一行js代码识别Selenium+Webdriver及其应对方案

    有不少朋友在开发爬虫的过程中喜欢使用Selenium + Chromedriver,以为这样就能做到不被网站的反爬虫机制发现. 先不说淘宝这种基于用户行为的反爬虫策略,仅仅是一个普通的小网站,使用一行 ...

  8. selenium webdriver学习(三)------------执行js脚本

    selenium webdriver学习(三)------------执行js脚本 博客分类: Selenium-webdriver   在用selenium 1.X的时候常常会用到getEval() ...

  9. selenium webdriver——JS对Input执行输入

    直接设置value属性, 此方法主要应对输入框自动补全以及readonly属性的element,sendkeys不稳定 比如: Demo:用JS输入 import org.openqa.seleniu ...

随机推荐

  1. nginX 安装 启动

    选择源码安装  下载安装包  nginx-1.8.0.tar.gz   解压                     tar -zxvf  nginx-1.8.0.tar.gz    进入文件夹   ...

  2. HDP之HBase性能调优

    (官方文档翻译及整理) 一.系统级调优 1.保证充足的RAM 2.64位的操作系统 3.Linux的swappiness设置为0 : sysctl vm.swappiness=10 vim /etc/ ...

  3. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

    mongoose报错:DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and wil ...

  4. js类的constructor中不支持异步函数吗?

    解决方案: 1.如果是普通函数,可以用async 和await来解决你的问题但你这个是在constructor里,constructor 的作用是返回一个对像实例,如果加了async就变成返回一个pr ...

  5. tensorflow开发环境版本组合

    记录下各模块的版本 tensorflow 1.15.0       print tf.__version__ cuda 10.0.130            nvcc -v cudnn 7.6.4  ...

  6. Arm开发板+Qt学习之路-qt线程执行完毕发送signal主动释放线程内存

    header: #ifndef SENDCANMSGTHREAD_H#define SENDCANMSGTHREAD_H #include <QThread>#include " ...

  7. C# 获取鼠标在屏幕上的位置

    获取鼠标位置及鼠标单击了哪个按键.private void GetMousePoint() {     Point ms = Control.MousePosition;     this.label ...

  8. linux中shell内置命令和外置命令

    shell内置命令 无法通过which或者whereis去查找命令的位置 例如cd,cp这些命令是shell解释器内置的命令 当shell内置命令传入shell解释器,shell解释器通过内核获取相关 ...

  9. Python中autoescape标签使用详解

    1.spaceless标签:移除html标签中的空白字符.包括空格.tab键.换行符,示例代码如下: {% spaceless %}具体内容{% endspaceless %} 2.autoescap ...

  10. c# 读写SerialPort

     SerialDataReceivedEventHandler无反映不要忘记这2属性赋值. serialPort1.DtrEnable = true; serialPort1.RtsEnable = ...