Problem with get element text
-
The function get element text, I have problem with the output.
I tested and it can't have a new line if the text using the <br> tag, but it only make a new line if the text use a <p> tag.This is a text from this page http://bestfreespinner.com/about.php they use <p> tag
And this one use <br> tag
https://www.tokopedia.com/gamisterlaris/konveksi-gamis-syari-terbaru-ineke-blue-murahcantik
-
I'm not sure I understand what you're wanting to accomplish.In the bestfreespinner link, the tags are a list (<li>) not a paragraph (<p>).Are you wanting to pull the text at a certain <br>?Edit: I understand now, here's a little script that uses Javascript function and runs
"document.querySelector('#shop-948696 > div:nth-child(4) > p').innerHTML" (#shop-948696 > div:nth-child(4) > p can be copied with the debugger. Right click the tag > Copy > Copy Selector)Then uses [[SAVED_SCRIPT_RESULT]].replace(/<br>/g, '\n') AND the built in "Replace String " function.
You can also combine the Javascript from which would work in a one line;
document.querySelector('#shop-948696 > div:nth-child(4) > p').innerHTML
To:
(document.querySelector('#shop-948696 > div:nth-child(4) > p').innerHTML).replace(/<br>/g, '\n')Hope this helps :)
-
Thank you @Allister , I didn't know that I can use '\n' to make new line in output.