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

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
    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.

    点赞 评论

相关推荐