Questions tagged [jsdom]

Implementation of the WHATWG DOM and HTML Standards (among others) for node.js

jsdom allows construction of in-memory and in-process objects that represent the window, document, etc. from a browser. It tries to implement the latest DOM and HTML standards, among many others like the CSSOM.

820 questions
-1
votes
1 answer

My node app gives diffrent output on my vps(debian) then on my local machine(windows)

I have this piece of code: var jsdom = require('jsdom'); jsdom.env("http://sunwell.pl/index.php?id=ranking&t=2vs2&r=1", ['//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'], function(error, window){ if(error)…
-1
votes
1 answer

JQuery.contents not working using jsdom

This code does work in the browser, but in Node.js (using JSDom + Crawler), i returns undefined $('div').find('.class').contents()[0].wholeText Any idea on how to solve this? BTW, when I try to stringify this in nodejs, it returns the error…
Vinz243
  • 9,654
  • 10
  • 42
  • 86
-2
votes
4 answers

How to call a javascript function defined in a script tag?

Example: How would I call test()? Edit: I didn't explain this correctly. I am using the request module of node.js to load an external html…
camden_kid
  • 12,591
  • 11
  • 52
  • 88
-2
votes
2 answers

How to display snippets from a set of articles as the new HTML page

*I am trying to figure out how to iterate through the news articles, and present the headline and first sentence in a new HTML. Essentially how to create and display a snippet starting from the top? I am stuck on this.* This a sample HTML code:…
Lucas
  • 57
  • 7
-2
votes
1 answer

Best practice for reading styles of element JSDOM

To get style attributes from an element using JSDOM, I use the following: window.getComputedStyle(element) It's the only example I've found. Using element.style.someAttribute does not seem to return anything. Is usinging getComputedStyle the best…
-2
votes
2 answers

I'm Trying to access an array inside an obj but while in the same scope of that object

let imageObj = { imgArr: [ 'dead_battery.jpg', 'evolution.jpg', 'funny_cat_pic.jpg', 'funny_paper_guys.jpg', 'happy_image', 'wood_garden.jpg' ], currentImg: 0, changeImage: (image) => { imageCycle = setInterval((image) => { …
JoekorSan
  • 3
  • 1
-2
votes
1 answer

Parsing JSON from HTML

Using NodeJS I would like to parse a variable defined in JSON, which is embeded in HTML of 3rd party website. What is the easiest way to get mentioned variable from HTML? Chunk of HTML from which I would like to extract mentioned JS can be seen…
Sigismund
  • 1,053
  • 9
  • 21
-2
votes
1 answer

Jest / JSDOM - Pages of red output in test window when assigning to document

This is my test. When the comparison function fails, I will add a class to the input box, hence my test expects the classList to be of length 2. describe('confirm password element', () => { it('adds a class to the input box when the…
matt-p
  • 1,017
  • 2
  • 12
  • 21
-2
votes
2 answers

Jsdom webscraping

Sorry if it is too basic. I want to scrape a website which involves clicking links on page, and getting the resulting HTML. I read about the nodejs module called JSDOM which I suppose is built just for this purpose. Can anyone please direct me in…
Babar
  • 1,202
  • 1
  • 12
  • 21
-3
votes
2 answers

Is there an easier way to call JS functions in Node.js via HTML-buttons?

I'm trying to add a JavaScript function that I wrote myself, to an HTML button which I also did myself. I'm having problems calling the document.getElementById() function because I'm working with Node.js. I read in some other forum, you can work…
ElEss
  • 3
  • 2
1 2 3
54
55