I have to crawl the automobile manufacturers name from wikipedia
Here is my json code
ChoDoiXe-Automobile-Firm-list.json (3.9 KB)
If I do not use if function in line 9, the task can not crawl the second name such as Koller of Argentina
If I use if function in line 9, the task can not crawl anything
Please give me the best code
Thank you very much!!!
ulrich
September 10, 2021, 11:21am
2
Can you post a macro that we can run for testing?
Where is the issue? storeXpathCount?
Yes, I posted the running macro
My issues are if function in line 9, storexpathcount function in line 8
Post url page and add image to text to extract i can solve your problem
You can do it with my attachment macro script
I have looked at the page and I think this work takes a lot of time and numerous different parts of macros as the data is not sorted but is organized in a messy way in different columns (sometimes a column other times 4 columns, other times 3 columns, it takes a long time to write a good macro code.
uiuser
September 21, 2021, 5:17am
8
i tried with xpath but elements were not found
so only few titles were saved.
use DOM
getElementsByTagName(‘li’)
save till Vinaxuki
I am so sorry all !!! The previous macro hasn’t “xpath=” in code line 17 and 26
Here is the running macro
ChoDoiXe-Automobile-Firm-list.json (4.1 KB)
uiuser
September 21, 2021, 9:30am
10
I tried on my own with xpath
and it wasnt 100% successful
did you tried DOM/
uiuser
September 21, 2021, 9:54am
12
i tried xpath=//li
then i tried to extract all
it stopped in between
So, can you write the new macro to crawl them for me.
uiuser
September 21, 2021, 10:15am
14
{
“Command”: “executeScript”,
“Target”: “var x=document.getElementsByTagName(‘li’); \n\nvar d=”";\nfor (var a=1;a<x.length;a++)\n{\nd+= x[a].textContent + “\n”;\nif (x[a].textContent ==“Vinaxuki”) break;\n}\nreturn d;",
“Value”: “data”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “${data}”,
“Value”: “!csvline”,
“Description”: “”
},
{
“Command”: “csvSave”,
“Target”: “Automobiles”,
“Value”: “”,
“Description”: “”
}
now you can modify to save one at a time
uiuser
September 21, 2021, 10:16am
15
I have tried your logic but elements were not found
you need 2 loops
loop 1 will start with value 4
second loop will start with 1
it will be nested loop
it stopped in between as it cant find the element
Can you export it to json.
I paste your code to my ui macro, it can not running
uiuser
September 21, 2021, 10:47am
17
I have attached the code.
Auto.json (600 Bytes)
1 Like