在领英上发表一篇文章
Casperjs To publish a post in linkedin
我使用casperjs登录领英并发布帖子。
var casper = require('casper').create({
logLevel: "info", // Only "info" level messages will be logged
verbose: true , // log messages will be printed out to the console
waitTimeout: 50000
});
casper.start('https://www.linkedin.com/uas/login', function() {
this.echo(this.getTitle());
});
casper.thenEvaluate(function(term){
document.querySelector('input[id="session_key-login"]').setAttribute('value',term);
},'username');
casper.thenEvaluate(function(term){
document.querySelector('input[id="session_password-login"]').setAttribute('value',term);
},'password');
casper.then(function(){
this.click('input[name="signin"]');
console.log("clicking..........");
this.capture("linkedin.png");
});
casper.waitForSelector('a.publish', function() {
this.click('a.publish');
});
casper.waitForSelector('article.stream-article ', function() {
this.fillSelectors('article.stream-article',{
'textarea.title':'This is title',
},false);
this.capture('linked3.png');
this.capture('linked4.png');
});
casper.then(function(){
this.sendKeys('textarea.title',"casper.page.event.key.Tab");
this.capture('linkedin5.png');
});
casper.then(function(){
this.fillSelectors('iframe[id^="editor-textarea"]',{
'p':'This is title',
},false);
});
casper.run();
我能够登录并键入帖子的标题,但我无法选择iframe并键入帖子的描述。有人知道怎么做吗?
您是否尝试使用这个casper方法withFrame()
访问一个框架,关于最新版本。
casper.open("http://www.example.com", function() {
casper.withFrame('your-frame', function() {
this.test.assertSelectorExists('#id-selector-inside-frame', 'Selector found');
});
});
文件在这里http://casperjs.readthedocs.org/en/latest/modules/casper.html withframe
相关文章:
- 使用ajax在多个页面上发布一篇文章
- 计算一篇文章中的节数(不止一篇文章)
- 计算一篇文章中有多少节
- 如何提供指向'下一篇文章'
- 翻译一篇文章'上.单击'PHP中的事件,来自'window.open'到基本URL链接
- 我怎么能只用Javascript(AJAX)编写其中一篇文章呢
- 单击我的joomla网站上的模块标题以指向一篇文章
- 定位页面上的第一篇文章和最后一篇文章
- jquery按钮只在一篇文章中启用
- 如何点击按钮显示下一篇文章
- 将变量数据从.js的一篇文章中抓取到php中
- 每回一篇文章,页面都会向后滚动
- 如何获取我的博客上最后一篇文章的日期,并将其显示在另一个网站上?
- 在领英上发表一篇文章
- 使用Tumblr API获取下一篇或上一篇文章
- 在展开下一篇文章时折叠文章(Readmore.js - Extension)
- 如何滚动一个大的表面?(例如一篇文章)
- Angular Typeahead:点击建议并立即发表一篇文章
- 如何水平滚动到页面中的下一篇文章(或#等)
- 如何在网页上为网页上的每一篇文章单独添加facebook分享按钮