页面的Java代码使用带有LISA的selenium向下滚动

时间:2016-08-17 06:06:01

标签: java selenium

我正在使用Selenium和LISA。我们必须向下滚动到页面底部,我尝试了所有的selenium + java代码,但没有工作。我正在使用Chrome驱动程序。使用以下代码

JavascriptExecutor je = (JavascriptExecutor) dr;  
     je.executeScript("arguments[0].scrollIntoView(true);", 
dr.findElement(By.partialLinkText("Mail")));

1 个答案:

答案 0 :(得分:1)

当你想向下滚动页面时,

scrollIntoView(true);方法滚动到当前元素var redis = require("redis"), //client = redis.createClient(6379,"10.96.82.163"); client = redis.createClient(6379,"10.96.82.175"); app.get('/', function (req, res) { res.send("HEY Nodejs runnning on 10.96.82.175:4000"); }); app.put('/set/:arg1/:arg2', function (req, res) { client.set( req.params.arg1,req.params.arg2,function (err, reply) { if (reply==null) { res.send("null"); } else { res.send(reply.toString()); } }); }); app.get('/get/:arg1', function (req, res) { client.get( req.params.arg1,function (err, reply) { if (reply==null) { res.send("null"); } else { res.send(reply.toString()); } }); }); app.get('/incr/:arg1', function (req, res) { client.incr(req.params.arg1, function (err, reply) { if (reply==null) { res.send("null"); } else { res.send(reply.toString()); } //console.log(reply.toString()); }); }); app.put('/lpush/:arg1/:arg2', function (req, res) { client.lpush(req.params.arg1,req.params.arg2, function (err, reply) { if (reply==null) { res.send("null"); } else { res.send(reply.toString()); } //console.log(reply.toString()); }); }); app.get('/lpop/:arg1', function (req, res) { client.lpop(req.params.arg1, function (err, reply) { if (reply==null) { res.send("null"); } else { res.send(reply.toString()); } }); }); app.put('/sadd/:arg1/:arg2', function (req, res) { client.sadd(req.params.arg1,req.params.arg2, function (err, reply) { if (reply==null) { res.send("null"); } else { res.send(reply.toString()); } //console.log(reply.toString()); }); }); app.get('/spop/:arg1', function (req, res) { client.spop(req.params.arg1,1, function (err, reply) { if (reply==null) { res.send("null"); } else { res.send(reply.toString()); } //console.log(reply.toString()); }); }); app.put('/zadd/:arg1/:arg2/:arg3', function (req, res) { client.zadd(req.params.arg1,req.params.arg2,req.params.arg3,function (err, reply) { if (reply==null) { res.send("null"); } else { res.send(reply.toString()); } //console.log(reply.toString()); }); }); app.put('/hset/:arg1/:arg2/:arg3', function (req, res) { client.hset(req.params.arg1,req.params.arg2,req.params.arg3,function (err, reply) { if (reply==null) { res.send("null"); } else { res.send(reply.toString()); } //console.log(reply.toString()); }); }); app.get('/hget/:arg1/:arg2', function (req, res) { client.hget(req.params.arg1,req.params.arg2,function (err, reply) { if (reply==null) { res.send("null"); } else { res.send(reply.toString()); } //console.log(reply); }); }); app.listen(4000, function () { console.log('Example app listening on port 4000!'); }); 进入浏览器窗口的可见区域,所以你应该尝试如下: -

arguments[0]