学习问题记录

1python selenium 调用Chrome,提示不安全的data和您使用的是不支持命令行标记

我在网上查找了一段时间总算把和这一样的问题解决了

options = webdriver.ChromeOptions()

# options.add_experimental_option("excludeSwitches", ["ignore-certificate-errors"]) #去掉不受支持的命令行标记

options.add_argument('--user-data-dir=C:/Users/Administrator/AppData/Local/Google/Chrome/User Data/Default') #设置成用户自己的数据目录

driver = webdriver.Chrome(chrome_options=options)

上面的设置可以去掉“不安全 data;"  但还是会显示”请停用以开发者模式运行的扩展程序“。

我用的是chrome 59.0.3071.109(正式版本) (64 位)后来把chromedriver 版本换成 2.31  问题解决了

 

2python+selenium打开chrome浏览器,去掉ignore-certificate-errors提示

加这两行代码即可

        options = webdriver.ChromeOptions()

        options.add_experimental_option("excludeSwitches", ["ignore-certificate-errors"])

3webdriver 操作 Firefox 在关闭浏览器时弹出 “Plugin Container for Firefox已停止工作” 处理办法

   不用插件,将plugin-container.exe删掉

 

4Firefox 安装selenium ide插件失败:该附加组件无法安装 因为它似乎已损坏

此时千万不要去想着这个插件有问题,可能是Firefox的版本问题。

Firefox45之后的新版本安装插件时都要进行签名认证,未经验证的都不能安装。那么不要用新版本的Firefox就好了。安装45.0.2版本Firefox并修改其签名配置信息。

安装个45.0.2版本的,打开Firefox输入about:config, 点击“我保证会小心”进去后,搜索xpi,找到“xpinstall.signatures.required”,该值默认是true,双击该行将其值改为false

 

5、adb devices找不到设备

可能原因是手机的开发者debug模式没有开启,找到手机版本号点击3次既可弹出

6、使用appiumandroid7.0真机上测试程序时报错command failed shell ps uiautomator’”的解决方式

appium目前最新的windows版本是1.4.16,在android7.0真机上测试程序时会报错:command failed shell “ps ‘uiautomator’”。

网上大多数人的解决方法如下:

1、找到appium的安装目录下的adb.js文件,目录为:Appium\node_modules\appium\node_modules\appium-adb\lib 
2、打开adb.js,找到如下代码:

ADB.prototype.getPIDsByName = function (name, cb) {

logger.debug("Getting all processes with '" + name + "'");

this.shell("ps '" + name + "'", function (err, stdout) {

if (err) return cb(err);

stdout = stdout.trim();

var procs = [];

var outlines = stdout.split("\n");

在这段代码下面加入这行代码:

outlines.shift();

3、重启appium

而我用这种方法并没有解决问题,最后找到了下面这种方法,在这里分享一下:

1、找到appium的安装目录下的adb.js文件,目录为:Appium\node_modules\appium\node_modules\appium-adb\lib 
2、打开adb.js,找到如下代码:

ADB.prototype.shell = function (cmd, cb) {

  if (cmd.indexOf('"') === -1) {

    cmd = '"' + cmd + '"';

  }

  var execCmd = 'shell ' + cmd;

  this.exec(execCmd, cb);

};

在这段代码下面加入这段代码:

ADB.prototype.shell_grep = function (cmd, grep, cb) {

  if (cmd.indexOf('"') === -1) {

    cmd = '"' + cmd + '"';

  }

  var execCmd = 'shell ' + cmd + '| grep ' + grep;

  this.exec(execCmd, cb);

};

再找到如下代码:

ADB.prototype.getPIDsByName = function (name, cb) {

  logger.debug("Getting all processes with '" + name + "'");

  this.shell("ps '" + name + "'", function (err, stdout) {

    if (err) return cb(err);

    stdout = stdout.trim();

    var procs = [];

    var outlines = stdout.split("\n");

    outlines.shift();

    _.each(outlines, function (outline) {

      if (outline.indexOf(name) !== -1) {

        procs.push(outline);

      }

    });

    if (procs.length < 1) {

      logger.debug("No matching processes found");

      return cb(null, []);

    }

    var pids = [];

    _.each(procs, function (proc) {

      var match = /[^\t ]+[\t ]+([0-9]+)/.exec(proc);

      if (match) {

        pids.push(parseInt(match[1], 10));

      }

    });

    if (pids.length !== procs.length) {

      var msg = "Could not extract PIDs from ps output. PIDS: " +

                JSON.stringify(pids) + ", Procs: " + JSON.stringify(procs);

      return cb(new Error(msg));

    }

    cb(null, pids);

  });

};

把这段代码注释掉,用如下代码代替:

ADB.prototype.getPIDsByName = function (name, cb) {

  logger.debug("Getting all processes with '" + name + "'");

  this.shell_grep("ps", name, function (err, stdout) {

    if (err) {

      logger.debug("No matching processes found");

      return cb(null, []);

    }

    var pids = [];

    _.each(procs, function (proc) {

    var match = /[^\t ]+[\t ]+([0-9]+)/.exec(proc);

    if (match) {

    pids.push(parseInt(match[1], 10));

    }

    });

    if (pids.length !== procs.length) {

      var msg = "Could not extract PIDs from ps output. PIDS: " +

      JSON.stringify(pids) + ", Procs: " + JSON.stringify(procs);

      return cb(new Error(msg));

    }

    cb(null, pids);

  });

};

3、重启appium

问题解决。

7安卓手机 appium setting unlock 再次安装解决(亲试)

1. 修改源码文件。    C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js

注释如图,

 

8当数据表中有自增长主键时,当用SQL插入语句中插入语句带有ID列值记录的时候; 

1. 如果指定了该列的值,则新插入的值不能和已有的值重复,而且必须大于其中最大的一个值;

2. 也可以不指定该列的值,只将其他列的值插入,让ID还是按照MySQL自增自己填; 
这种情况在进行插入的时候,两种解决方法: 
①可以把id的值设置为null或者0,这样子mysql都会自己做处理 
②手动指定需要插入的列,不插入这一个字段的数据!

#方法①:insert into userInfo values(null,'ddf','8979');

insert into userInfo values(0,'ddf','8979');

#方法②:insert into userInfo(name,password) values('ddf','8979');

9、运行Jmeter时,响应数据中文乱码问题解决办法

Jmeter安装目录/bin/jmeter.propertiessampleresult.default.encoding默认为ISO-8859-1,将参数修改为

sampleresult.default.encoding=utf-8 即可

同时注意将注释符号#去掉,否则不会生效

 

10、jmeter运行多个线程时结果树里有重复记录?为什么呢

 

 

11、Jmeterhttp信息头里传入token参数仍然显示登录过期????

因为token关键字传错了,系统中时tokenStr传入的是token

12、Jmetertxt文件中读取的参数错误,重复了一次,但是有一个没读。为什么??checkUserAuditportType

 

13、Python3】error: Microsoft Visual C++ 10.0 is required 错误解决办法

Python初学者一枚,目前使用python3.4.3。

今天通过pip安装numpy时遇到了“error: Microsoft Visual C++ 10.0 is required”错误。

网上有许多解决方法,但比较乱,有的还需要安装vs2010!然而微软早已不提供vs2010下载。当然,最后本人作为python初学者还是解决了这个问题。估计其他的初学者也可能会遇到类似的问题,因而写一下这篇文章。

本文的方法参照这篇文章:http://qiita.com/tobira-code/items/f1700545c715f3e8c602。不需要安装vs2010。

正文开始:

1. 通过pip安装numpy并遇到错误(或者其他模块):

[plain] view plain copy

1. pip install numpy  

2. (安装中...)  

3. error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).  

 

2. 这时候怎么办?不要着急,打开下面的网页:

https://www.lfd.uci.edu/~gohlke/pythonlibs/

这个网页提供了许多python需要用到的运行环境文件。

3. 找到需要的文件。

比如我需要的是Numpy的文件,首先搜索到Numpy:

 

我安装的是64位的python3.4,因此选择下载

“numpy-1.9.3+mkl-cp34-none-win_amd64.whl文件”

如果安装的是32位的python3.5,则应该下载numpy-1.9.3+mkl-cp35-none-win32.whl。

4. (用管理员模式)打开cmd(命令提示符),跳转到numpy-1.9.3+mkl-cp34-none-win_amd64.whl所在的文件夹。

[plain] view plain copy

1. pip install numpy-1.9.3+mkl-cp34-none-win_amd64.whl  

问题解决。

注意:其他版本没有测试过,个人通过该方法能够解决问题。

 

#2016更新:

其实通过这个办法可以安装很多模块。如果再遇到什么无法解决的问题,就回想一下这个方法吧!

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值