douqianxian7008 2015-04-02 19:43
浏览 44
已采纳

php浏览器simpleTest登录问题

I am trying to login to a website using simpleTest browser.

Below is my code

require_once('simpletest/browser.php');

$browser = new SimpleBrowser();

$browser->get('http://uosom.dzxpy.servertrust.com/login.asp');
$browser->setField('email', 'asher@wds-testing.com');
$browser->setField('password', 'password123');
echo $browser->clickSubmitByName('imageField2');

It is not logging me in and even it does not throw an error.

Can anyone please tell me what I am doing wrong?

  • 写回答

1条回答 默认 最新

  • dongluanan7163 2015-04-02 21:13
    关注

    It is beacuse the type of imageField2 isn't submit but image. Function ClickSubmitByName() searches for inputs of type submit (Your input code is <input type="image" border="0" name="imageField2" src="v/vspfiles/templates/240/images/buttons/btn_login.gif">). You can use ClickImageByName() instead.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符