Help with understanding Javascript browser automatisation approach

aladin

Regular Member
Sep 18, 2008
222
22
Hi to all coders
I am a medium coder in C#,. Net selenium browser automatisations etc. for about 10 years. Various projects
Few days ago I tried to code in Javascript due to the very big similarities between c# AND JS.
But strange nothig related to browser automatisation is working.
I can parse texts, make math in Javascript but I cannot do browser automatisations.
For example I tried simple task to automate the login to my WordPress site page. In Javascript. I coded in notepad++ and tried also in visual code studio.
I navigate to wp-admin and command to fill the user and pass and press the submit form.
I know how to use id's and name for identify the css.i made comex projects in c# in this field.
But.. Nothing in JS..
So I must have Installed selenium or other similar tool for automatisation? It is not working without selenium?
If so where to Install.. Selenium :)) in notepad ++ :))
Is selenium is required.. Do you have any selenium alternatives? For example in C# some coders Consider selenium outdated.
I tried some tutorials o with JS from yt and net but there are very low quality comparing with. Net tutorials in various languages.
Regards.
 
Last edited:
I've read that Puppeteer is easier than Selenium but I've not used either recently.
 
Okay so browser automation with selenium works like this:
1. You need to see which browser you are using.

2. Depending on browser, you download the "webdriver".
Eg. For chrome you download chrome driver and for firefox you download geckodriver.

3. You download a module that allows you to use the webdriver to automate the browser.

This is the flow of how things work:
Your code (made using selenium module) -> webdriver -> browser
 
Okay so browser automation with selenium works like this:
1. You need to see which browser you are using.

2. Depending on browser, you download the "webdriver".
Eg. For chrome you download chrome driver and for firefox you download geckodriver.

3. You download a module that allows you to use the webdriver to automate the browser.

This is the flow of how things work:
Your code (made using selenium module) -> webdriver -> browser

I use python and would suggest you to use python and for automation I'll go about like this:

1. Create a project folder.
2. Move webdriver in that folder.
3. pip install selenium
4. Refer to selenium python documentation to connect to driver and write automation
 
Okay so browser automation with selenium works like this:
1. You need to see which browser you are using.

2. Depending on browser, you download the "webdriver".
Eg. For chrome you download chrome driver and for firefox you download geckodriver.

3. You download a module that allows you to use the webdriver to automate the browser.

This is the flow of how things work:
Your code (made using selenium module) -> webdriver -> browser
Thank you.. But where to install let say Firefox selenium? . I have I stalled selenium for Firefox as an addon. But.. Nothing. For C# and. Net was the repository. And for pyton I use pip...
But for Javascript?
 
Last edited:
Thank you.. But where to install let say Firefox selenium. I have I stalled selenium for Firefox as an addon. But.. Nothing. For C# and. Net was the repository. And for pyton I use pip...
But for Javascript?
You can simply search for keywords like "geckodriver" and "chromedriver" they are simple executables.

Geckodriver will be available on it's respective GitHub page and chrome driver has a website for it
 
Thank you.. But where to install let say Firefox selenium. I have I stalled selenium for Firefox as an addon. But.. Nothing. For C# and. Net was the repository. And for pyton I use pip...
But for Javascript?
And for javascript, you should have a selenium module, you should browser NPM for it
 
And for javascript, you should have a selenium module, you should browser NPM for it
NPN standard for node package manager and it's basically a website where you can find modules for node.js i.e javascript

Then you can install it to your project by using command:
npm install your_module
 
Thank you all. So for now I understand that in order to be able to automate the ( letsay) Firefox I need also the web driver selenium installed. Not simple html with Javascript as I tried before. I will try as you said
 
First, JavaScript was originally built to work in browsers only. So, the engine is basically the browser, everything executes on the client side.

Manipulating browser's action from outside using an inside browser thing is like.. well, the snake eating its own tail.

So you need JavaScript running outside the browser. Some smart people invented NodeJS. That's a JavaScript engine running on server's side.
Now things sound different, right? We have a JavaScript engine and a browser. Can the engine manipulate the browser?

YES

How? You need a NodeJS module called Puppeteer. It was linked above by someone else.

Selenium is for Python, forget about it.

So, the steps are:

1. Install NodeJS
2. Npm install Puppeteer
3. RTFM for both things
4. Learn some JS concepts like async/await, promises/callbacks and some other hell-ish stuff
5.execute
Code:
node script.js
 
Larry Igna thank you. I now understand the concept of Javascript. In c# was easier to understand the concept and I made a lot of boots. . But now I understand also with JS. I will try also the JS to see how operate..and I see that I need also node JS for browser automation.
Thank ykh
 
I made a wrong statement, it looks like they brought Selenium to JavaScript too.

I've made some bots in the past using only Puppeteer, it looks like Selenium is very similar, you can read the docs for both and see which fits your needs best.
 
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock