-
Notifications
You must be signed in to change notification settings - Fork 43
[Feature]: Selenium Migration to Power Fx Function extension #522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Consider the following possible case mport org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class PowerAppAutomation {
public static void main(String[] args) {
// Set the path to the ChromeDriver executable
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
// Initialize the ChromeDriver
WebDriver driver = new ChromeDriver();
try {
// Navigate to the Power App URL
driver.get("https://powerapps.microsoft.com");
// Call the runTest method with the open driver
runTest(driver);
} finally {
// Close the browser
driver.quit();
}
}
public static void runTest(WebDriver driver) {
// Example interaction: Find and click a button
WebElement button = driver.findElement(By.id("button-id"));
button.click();
// Example interaction: Enter text into a text field
WebElement textField = driver.findElement(By.id("text-field-id"));
textField.sendKeys("Sample text");
// Add more interactions as needed
}
} Which might be something similar to the following with Playwright import com.microsoft.playwright.*;
public class PowerAppAutomation {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions().setHeadless(false));
BrowserContext context = browser.newContext();
Page page = context.newPage();
// Navigate to the Power App URL
page.navigate("https://powerapps.microsoft.com");
// Call the runTest method with the open page
runTest(page);
// Close the browser
browser.close();
}
}
public static void runTest(Page page) {
// Example interaction: Find and click a button
page.click("#button-id");
// Example interaction: Enter text into a text field
page.fill("#text-field-id", "Sample text");
// Add more interactions as needed
}
} Assuming that page navigation and authentication is done using Test Engine the following class public class PowerAppAutomation {
public static void runTest(Page page) {
// Example interaction: Find and click a button
page.click("#button-id");
// Example interaction: Enter text into a text field
page.fill("#text-field-id", "Sample text");
// Add more interactions as needed
}
} Given this class is already public and static it could be called via a No cliffs extensibility model. For example using JNI using System;
using System.Runtime.InteropServices;
class Program {
[DllImport("jvm.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int JNI_CreateJavaVM(out IntPtr pvm, out IntPtr penv, IntPtr args);
static void Main(string[] args) {
IntPtr jvm, env;
JNI_CreateJavaVM(out jvm, out env, IntPtr.Zero);
// Load the Java class and call the method
IntPtr classHandle = env.FindClass("PowerAppAutomation");
IntPtr methodId = env.GetStaticMethodID(classHandle, "runTest", "(Lcom/microsoft/playwright/Page;)V");
// Assuming you have a way to get the Page object
IntPtr page = ...; // Obtain the Page object
env.CallStaticVoidMethod(classHandle, methodId, page);
}
} |
Also could consider Playwrightium
|
Ideally, Test Engine will be able to handle Selenium and Playwright. As mentioned, significant investment in Selenium by organizations in the past, the present in the future indicate this is needed. Selenium offers features not available in Playwright, and vice versa. Selenium includes a very robust community and is the base for an existing UI automation framework for Dynamics 365. |
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
Many organizations have made significant investments in Selenium for automated testing, and it is essential to leverage these existing test components within the Power Apps Test Engine.
Describe the solution you'd like
Propose adding migration guidance and samples for integrating Selenium-based test components into the Power Apps Test Engine. This would allow users to utilize their existing Selenium tests, which are often written in Java, within the Test Engine.
This guidance could cover steps migrating these tests to Playwright and a language bridge from Java to C# would also be beneficial to facilitate a smooth transition.
It could cover:
Describe alternatives you've considered
No response
Additional context?
No response
The text was updated successfully, but these errors were encountered: