我有這樣的代碼......iMacros的:如何處理缺少的元素/值對提取數據正確
VERSION BUILD=8032216
TAB T=1
SET !REPLAYSPEED FAST
SET !ERRORIGNORE YES
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
SET !EXTRACT_TEST_POPUP NO
URL GOTO={{URL}}
TAG POS=1 TYPE=H2 ATTR=* EXTRACT=TXT
SET !VAR0 {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:vs_members_companyname* EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:member-address* EXTRACT=TXT
SET !VAR2 {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:vs_members_contact* EXTRACT=TXT
SET !VAR3 {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:vs_members_phone* EXTRACT=TXT
SET !VAR4 {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:vs_members_email* EXTRACT=TXT
SET !VAR5 {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:vs_members_url* EXTRACT=TXT
SET !VAR6 {{!EXTRACT}}
SET !EXTRACT NULL
SET !EXTRACT NULL
ADD !EXTRACT {{!VAR0}}
ADD !EXTRACT {{!VAR1}}
ADD !EXTRACT {{!VAR2}}
ADD !EXTRACT {{!VAR3}}
ADD !EXTRACT {{!VAR4}}
ADD !EXTRACT {{!VAR5}}
ADD !EXTRACT {{!VAR6}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=AdelcookChamber.csv
SET !EXTRACT NULL
當iMacros都沒有找到文本/元/對頁面上的屬性類它給結果#EANF#。然而,它會移動提取的.csv文件列,並在提取的數據的末尾處放置#EANF#,其中這些元素位於頁面上,實際上是頁面上要提取的數據上面沒有這些元素的數據元素/值。
我正在iMacros瀏覽器版本中運行此操作,播放循環設置爲8.無論如何處理這個問題,而不進入腳本?我只需要將#EANF#標記爲無法在頁面上找到的屬性值。 ------------------------------------------------ ----------------------------------------
冰鎮感謝兄弟回覆!你能幫我一下,因爲我不懂JavaScript嗎?這段代碼如何看起來基於我的代碼?
我清理了代碼,以便您可以看到它將一切都很好;當電子郵件和網址未找到錯誤放入其他行的元素時除外。
我正在播放循環8X(頁面上的記錄數)。
VERSION BUILD=8032216
TAB T=1
SET !ERRORIGNORE YES
SET !REPLAYSPEED FAST
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
SET !EXTRACT_TEST_POPUP NO
FILTER TYPE=IMAGES STATUS=ON
URL GOTO=http://www.adelcookchamber.org/membership-directory/category/advertising/
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:vs_members_companyname EXTRACT=TXT
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:member-address EXTRACT=TXT
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:vs_members_contact EXTRACT=TXT
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:vs_members_phone EXTRACT=TXT
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:vs_members_email EXTRACT=TXT
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:vs_members_url EXTRACT=TXT
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:vs_members_cats EXTRACT=TXT
Wait SECONDS=2
SAVEAS TYPE=EXTRACT FOLDER=* FILE=Adelcook_Chamber.csv
IceD簽出我上面的回覆;低於------- – user2520517
搜索堆棧溢出。 :) http://stackoverflow.com/questions/14909553/loop-in-imacros-using-javascript – macroscripts