Comments (3)
What do you mean child app, another window process, or just another Window in the same app?
You can find the document about JavaScript WebDriver API.
If you are talking Window, It's possible you are looking for:
this.getWindowHandle() → Promise
this.getAllWindowHandles() → Promise<Array>
If you are launching child process, it's possible to start another session with appId = "Root", then search for the element.
It's more easy to communicate if you knows which endpoint your java client hit.
from selenium-appium.
just another Window in the same app which get's popup after interacting with the App @licanhua
// Parent app windows
it("Get RHAM App Title", async function () {
let rhamTitle = await RHAMPage.getTitleBar();
expect(rhamTitle).equal('Remote Hardware Access');
});
// This test launches separate new app window
it("Restart WebSocket Client", async function () {
await RHAMPage.clickRestarWebSocket();
});
// Want to take action on separate new app window
it("Clear SignalRClient", async function () {
await RHAMPage.clearClientScreen();
});
const getAllWin = await driver.getAllWindowHandles();
const allWinHandles = await driver.getWindowHandle();
console.log('All Windows', getAllWin); // All Windows [ '0x002C0882' ]
console.log('WindowHandle', allWinHandles); //WindowHandle 0x0025072A
from selenium-appium.
I feel like driver.getAllWindowHandles()
should provide these, but the returned array is always empty for me.
The workaround that I'm using is to use a root driver to find a window by name.
I'm not in love with it, as finding a window from root takes 5-10 sec, but it is working on my multi-window application.
I have this helper:
import { By2, WebDriver2, windowsAppDriverCapabilities } from "selenium-appium"
let rootDriver
export const getWindowDriver = async (name) => {
// first request will create a root driver
if (!rootDriver) {
rootDriver = new WebDriver2()
await rootDriver.startWithCapabilities(windowsAppDriverCapabilities("Root"))
}
const item = By2.nativeName(name, rootDriver)
const hexId = parseInt(
await item.getAttribute("NativeWindowHandle")
).toString(16)
const driver = new WebDriver2()
await driver.startWithCapabilities({
browserName: "",
platformName: "windows",
deviceName: "WindowsPC",
appTopLevelWindow: hexId,
})
return driver
}
and then tests can request window drivers with this:
// do something that opens a window called "MyApp Settings"
const settingsDriver = await getWindowDriver("MyApp Settings")
await By2.nativeName("edit button", settingsDriver).click()
from selenium-appium.
Related Issues (13)
- UnknownMethodError: Method is not implemented for getAttribute() and isDisplayed() HOT 1
- 如何发送“鼠标右键单击”命令? HOT 5
- By2 not compatible with Locator
- No easy way to wait for an element to be displayed HOT 1
- Example not working HOT 4
- Double click not working HOT 2
- "status":105,"value":"error":"element not interactable" HOT 3
- Incompatible with latest releases of appium-windows-driver HOT 3
- "Target browser must be a string" Builder still expects browser. HOT 3
- Imports broken on case sensitive file system HOT 4
- Unrecognized command: actions HOT 1
- Package doesn't work on a case sensitive filesystem HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from selenium-appium.