0

I have to test a website using Selenium.

This website is a graphical user interface for controlling a device and to shows data from that device.

This device is using SNMP which is used to give an alert when something goes wrong.

My task is to test both, GUI and SNMP using Selenium.

Is it possible to test a GUI and a network protocol using Selenium? Or do I have to use another framework with Selenium?

Is there a framework to test both GUI and Network protocol?

2
  • Your testing mission is not clear. "my task is to test both GUI and SNMP using selenium" does not say which risks are you investigating with your testing, nor the oracles, assumptions, and restrictions you have in your testing. May 18, 2022 at 18:23
  • Just to clarify other answers here- Selenium uses a programming language to implement the tests (assuming you don't use Selenium Studio or similar no code tool), using the same programming language one can also implement SNMP testing and combine the tests. This could be Java, JS, Python, C# or any other of your favorite languages
    – Rsf
    May 27, 2022 at 8:25

2 Answers 2

2

With Selenium alone you may not be able to test your Web GUI and the SNMP set-up.

Selenium is only for automation actions that can be performed in a web browser. So it won't help in testing SNMP.

But assuming you are using Java you can use other Java code and libraries to test your SNMP set-up.

Here are a few references that you refer to achieve your goal,

https://www.snmp4j.org/

https://examples.javacodegeeks.com/enterprise-java/snmp4j/test-driven-development-snmp4j/

http://techdive.in/snmp/log4j-snmp-trap-appender

https://stackoverflow.com/questions/11451073/test-snmp-connection-availability

You may also find such libraries for other programming languages as well.

2
  • Thank you for taking the time and answering my question. There are actually some libraries to send and receive traps/informs with SNMP. how can i add this snmp-test to my selenium implementation ?
    – anas
    May 20, 2022 at 12:02
  • You build infrastructure to enable messaging and triggering of SNMP and selenium. You'll need to customize both the selenium testing and the SNMP testing to build something that lets them communicate. I can't detail building the infrastructure here - complicated and expensive and not an SO answer to your question. May 21, 2022 at 10:29
0

Is it possible to test a GUI and a network protocol using Selenium?

The short answer is: no. As per the Selenium website, "Selenium automates browsers. That's it!"

In other words, Selenium only communicates at the browser level. It has no way of understanding or communicating with the network level.

Or do I have to use another framework with Selenium?

Maybe. It might be possible to create your own tool to add to your Selenium implementation or find a suitable tool to add.

Is there a framework to test both GUI and Network protocol?

There are tools for networking like Charles Proxy, Fiddler, and Wireshark, but I've never seen anyone use these in conjunction with Selenium.

Update:

Based on more info from the OP, I'm biased toward using a JavaScript solution for Selenium (WDIO for example) or even using Playwright. In this case, there is an SNMP package the OP found; there are others listed on npmjs.

The solution is to add one of these solutions to your package.json or via your package manager. Import the library into your class file (likey PageObject class), and instantiate the object for the SNMP class. In the PageObject class, you can use the SNMP library like any other code and return any values needed back to the test/spec file for assertions.

This question has a Selenium-IDE tag, so no, this solution won't work in Selenium-IDE.

3
  • Thank you for taking time and answering my question. there is actually snmp-Libraries. how can we add external libraries to our Selenium implementation ?
    – anas
    May 20, 2022 at 12:13
  • @anas Good to know. I just haven't needed to do any testing around snmp. Anyway, if you found a library, refer to the docs. Otherwise, you'll likely need to add it like any dependency; import it into your class (likely your PageObject); and then instantiate the object (assuming your using OOP). You cannot do this in Selenium IDE. Sorry for being general, we don't know what your tech stack, programming language is that you're using.
    – Lee Jensen
    May 20, 2022 at 15:22
  • thanks that was helpful . i am allowed to use python or JavaScript in this project . there is for both of them a snmp-lib . in python there is 2 libs : pysnmp.readthedocs.io/en/latest and easysnmp.readthedocs.io/en/latest in Javascript : github.com/markabrahams/node-net-snmp
    – anas
    May 20, 2022 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.