Automate flutter web application using selenium webdriver
Asked Answered
C

3

5

I am new to flutter. So, I want to know whether I can use selenium webdriver/java to automate a flutter web application.

I have used java / cucumber to automate web applications and used page object pattern. so, can I do the same technologies to automate a flutter web application ?.

Cowey answered 10/3, 2021 at 12:11 Comment(0)
A
5

Yes you can, because the automation code is going run on top of the application. So there is no restriction. There is a package available in flutter WebDriver maybe you can try this out . And here is the API documentation.

Araarab answered 10/3, 2021 at 14:47 Comment(6)
Thanks for the answer. I would like to know how I can develop page objects. Can I develop as java classes?. Or they should be .dart files. I tried to find the maven dependency for flutter driver. But it seems there is no maven dependency for flutter web driver.Cowey
You can use selenium-webdriver/java or flutter-webdriver/dart to automate. If you want to use flutter(dart) here is a youtube playlistAraarab
Thanks a lot. Now it is clear for me. I will go with selenium/ java.Cowey
@Cowey I'd be interested to learn if/how you actually managed to make this work. In my experience the Flutter web app is a black box to the browser and to selenium...Sidestroke
Can you please share the sample code with selenium-web driver/java? @CoweyJester
This is not possible so far with Flutter 3 Web. Have you been successful in anyway (example please) at this point of time ?Leviathan
A
3

You can automate flutter web applications using selenium, robot framework or any automation tool, but first, you need to execute javascript command to show the tree of elements in the page then you can use them in your automation.

document.querySelector('flt-glass-pane').shadowRoot.querySelector('flt-semantics-placeholder').click({force: true});
Amylum answered 4/3 at 10:19 Comment(0)
S
0

You cannot.

Flutter does not render into html elements like a normal web framework. It renders the entire site as one image, so there's no way to use selenium. You'd have to use image based automation to automate it.

Here's a medium article that explains in detail why this is not possible.

Suter answered 11/1 at 16:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.