AlwaysNoob
AlwaysNoob

Reputation: 75

Selenium WebDriver for automating ReactJs application

Can Selenium WebDriver be used for automating ReactJs application ? I started using Selenium WebDriver, and stuff is getting done but in really slow fashion because I am encountering a lot of issues in finding elements in the ReactJS web-app. Not sure of the clear reason that why is WebDriver not able to find elements in ReactJS web-app unlike other applications that run in a browser.

Upvotes: 2

Views: 4877

Answers (2)

Ehtesham Ahmed
Ehtesham Ahmed

Reputation: 69

From your exception, it appears that Selenium has located the element but it is not clickable. One of the reasons could be changing states of the element which happens in case of ReactJS e.g. username and password fields on Gmail login.

I have also stumbled on a similar problem but I have narrowed down the cause to randomly changing ID of the element. You might be able to solve it by requesting developer to use ID against each element so that it can make locating elements easier.

Another option could be to use partial link to locate the element

Upvotes: 2

thinhvo0108
thinhvo0108

Reputation: 2242

In fact, Selenium will work for all websites, it doesn't matter the sites are developed by which technology (because after all, after sites some to browsers, they're just HTML, CSS and also JS)

Therefore, as far as I know, perhaps because of the way react-sites' elements have inline css (and may not have Class or ID), so it makes it more difficult for the Selenium web driver to find DOM elements, that's it!

Upvotes: 2

Related Questions