日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
PhantomJScontent屬性

PhantomJS是一個基于WebKit的服務器端JavaScript API,它允許你在沒有瀏覽器的情況下運行JavaScript代碼,PhantomJS可以用于自動化測試、網(wǎng)頁截圖、網(wǎng)絡爬蟲等場景,在PhantomJS中,content屬性用于設置或獲取網(wǎng)頁的內(nèi)容。

為陸豐等地區(qū)用戶提供了全套網(wǎng)頁設計制作服務,及陸豐網(wǎng)站建設行業(yè)解決方案。主營業(yè)務為成都網(wǎng)站設計、成都網(wǎng)站制作、陸豐網(wǎng)站設計,以傳統(tǒng)方式定制建設網(wǎng)站,并提供域名空間備案等一條龍服務,秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!

1、設置content屬性

要設置網(wǎng)頁的內(nèi)容,可以使用如下方法:

使用setContent方法:

var page = require('webpage').create();
page.open('http://example.com', function(status) {
    if (status === 'success') {
        page.setContent('

Hello, World!

'); } });

使用evaluate方法:

var page = require('webpage').create();
page.open('http://example.com', function(status) {
    if (status === 'success') {
        page.evaluate(function() {
            document.body.innerHTML = '

Hello, World!

'; }); } });

2、獲取content屬性

要獲取網(wǎng)頁的內(nèi)容,可以使用如下方法:

使用getContent方法:

var page = require('webpage').create();
page.open('http://example.com', function(status) {
    if (status === 'success') {
        console.log(page.getContent());
    }
});

使用render方法將內(nèi)容輸出到文件:

var page = require('webpage').create();
page.open('http://example.com', function(status) {
    if (status === 'success') {
        page.render('output.html');
    }
});

3、content屬性的用途

content屬性主要用于以下場景:

修改網(wǎng)頁內(nèi)容:通過設置content屬性,可以動態(tài)地修改網(wǎng)頁的內(nèi)容,實現(xiàn)網(wǎng)頁的自動化操作。

網(wǎng)頁截圖:通過設置content屬性,可以將網(wǎng)頁內(nèi)容渲染成圖片,實現(xiàn)網(wǎng)頁截圖功能。


當前文章:PhantomJScontent屬性
文章位置:http://m.5511xx.com/article/cojhegg.html