Selenium 利用javascript 控制滚动条

发表于:2013-9-10 11:15

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:流口水的    来源:51Testing软件测试网采编

分享:

  以下备注所用test.html 的代码(我也是在网上找的,简单的修改显示文字而已),供大家使用:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
<html xmlns=http://www.w3.org/1999/xhtml>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Selenium Study</title>
<script language="JavaScript">
function check(){
var clientHeight = document.getElementById('text').clientHeight;
var scrollTop    = document.getElementById('text').scrollTop;
var scrollHeight = document.getElementById('text').scrollHeight;
if(clientHeight + scrollTop < scrollHeight){
alert("Please view top news terms !"); return false;
}else{
alert("Thanks !");
}
}
function set()
{
document.getElementById('text').scrollTop=10000;
}
</script>
</head>
<body>
<form id="form1" method="post" onsubmit="return check();">
<textarea id="text" name="text" cols="70"  rows="14">
Selenium IDE is the a Firefox plugin that does record-and-playback of interactions with the browser. Use this to either create simple scripts, assist in exploratory testing. It can also export Remote Control or WebDriver scripts, though they tend to be somewhat brittle and should be overhauled into some sort of Page Object-y structure for any kind of resiliency.
Selenium IDE is the a Firefox plugin that does record-and-playback of interactions with the browser. Use this to either create simple scripts, assist in exploratory testing. It can also export Remote Control or WebDriver scripts, though they tend to be somewhat brittle and should be overhauled into some sort of Page Object-y structure for any kind of resiliency.
Selenium IDE is the a Firefox plugin that does record-and-playback of interactions with the browser. Use this to either create simple scripts, assist in exploratory testing. It can also export Remote Control or WebDriver scripts, though they tend to be somewhat brittle and should be overhauled into some sort of Page Object-y structure for any kind of resiliency.
Selenium IDE is the a Firefox plugin that does record-and-playback of interactions with the browser. Use this to either create simple scripts, assist in exploratory testing. It can also export Remote Control or WebDriver scripts, though they tend to be somewhat brittle and should be overhauled into some sort of Page Object-y structure for any kind of resiliency.
</textarea><br /><br />
<input type="submit" id="submit" name="submit" value="Submit" />
</form>
</body>
</html>

33/3<123
春暖花开更文季,点击参与还有惊喜礼品~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计

法律顾问:上海漕溪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2023
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号