Selenideium Element Inspector v1.2 has been released

I am an enthusiastic developer since my childhood. I have started with Plus 4 and C 16 machines programming in Basic. I still remember when we were jumping on the bed with my brother, and accidentally saw the Commodore 64 computer on the top of the wardrobe, which was planned to be a Christmas gift for us. I don't have to tell you that we couldn't wait till then. :) I will never forget this memory. Of course in the beginning we only played on the computer, but later I became interested in how can I make my own programs. I have to tell when I first faced the binary number system I did not understand it, but I was still able to draw some sprites on the screen. :)
I continued learning software development during grammar school. I got my Masters degree at the Budapest University of Economics and Technology where I learnt many languages and also learnt a lot about general software development theory and practice.
I have started my professional career as a C++/C# developer, but I switched to Java after a few years. I've visited many meetups and Code Retreats during this time and I've learnt and introduced Agile methodologies in our company. During the years I lead the development team in close cooperation with the product management and testing department.
In 2020 I felt I need something new and I turned towards test automation both API and UI. I did not regret my decision. Since then I tried many frameworks like RestArrured, Selenium, Protractor, Appium, Selenide and Karate.
At the moment I am working as a Senior Software Developer in Test using Selenium and Selenide for UI testing and Karate for API testing.
I believe knowledge sharing is very important, so apart from helping my colleagues work I started my technical blog recently: https://mszeles.com Sharing your knowledge provides many ways for your own development. Whenever I write an article many questions come into my mind which might be interesting for the readers, so I try to answer all of them in my posts. Doing this I learn a lot about the subject. In additionally sharing your knowledge gives a good opportunity for feedback based on which you can further improve.
Great news!
The new version of Selenideium Element Inspector can be downloaded from the Chrome web store.
So let's have a look, what are the new features
- Relative XPath Selector
- CSS selectors based on any unique attribute are automatically generated for the web elements (except id, name, class as they are covered a different way).
- In case one of the classes of the element is unique, CSS selector is also generated based on that
- Automatically add ";" to the end of the selector, so you really only have to copy-paste the code.
- Marking the start and end of the logs belonging to Selenideium Element Inspector
Download Selenideium Element Inspector v1.2, and have fun.
Please leave a review in case you find the plugin useful!
Buy me a coffee in case you save time by using Selenideium Element Inspector! 😊
In case you are interested in the implementation details, then keep on reading.
Implementing Selenideium Element Inspector v1.2
However, my code did what it had to I have to admit it was ugly. There were many duplications in it. I have only started learning JavaScript now, but that cannot be an excuse, as clean code is independent of the language. So before we introduce new functionality
Let's refactor
I have removed the duplication by collecting Selenide and Selenium selectors into 2 lists, and also added 2 utility methods, to create the complete copy-pastable selector.

Looks nice. Don't you think?
Let's start implementing the first feature!
CSS selectors based on any unique attribute
Usually, there are many attributes of a web element, so it would be quite handy if could generate the selectors based on those attributes. Here is the code:

Now move to the next feature:
Generate CSS selector based on unique class name

It was simple, don't you think? The last feature for today:
Generate relative XPath selector

And we are ready. You can find the source code at my GitHub account.
But there is a known bug. I tried to solve it for several hours but I was not able to do that, so I asked my second question on StackOverflow and also asked it on Twitter. Up till now, no answer has arrived. In case you have any idea how to solve the issue, please do not hesitate to contact me. I will buy a beer for you. 🍺
Buy me a coffee in case you save time by using this plugin! 😊
P.S.: Support me by sharing this article in case you found it useful.
📚Join the Selenide community on LinkedIn! ✌




