Execute JavaScript

I try to use custom actions with codeceptJS and use therefore the code

	I.executeScript(function() {
	$('#Sidemenu').hide();
});

But this do not work, I got a error message that $ is undefined. I expected that I can run jquery with it.
Do I think wrong in this direction?

You can run jquery with $ you are not wrong. Could you please share a detailed error?

Well, the executeScript function executes in the context of the browser only. So whatever the current browser page has loaded, you can then access it inside executeScript’s function block.

In your case, it would appear the page doesn’t use jQuery, so it doesn’t know what $ is.

Ok, thank you for the information. I thought that jquery is part of codeceptJS and so I can use it. I use now plain java script an it is working well.

	I.executeScript(function() {
	document.getElementById('cl-sidemenu-overlayer').click();
});