ui-automation


How to find Window by variable title using TestStack.White framework?


I am using TestStack.White framework to automate opening new document in MS Word 2013.
I am opening Microsoft Word application with:
Application application = Application.Launch("winword.exe");
After that, I am trying to get the window by partial title:
Window window = application.GetWindow("Word", InitializeOption.NoCache);
But it throws an exception saying that there is no such window.
Window title is: Document1 - Word
The question is: How to get a window by partial title taking into consideration that the title is changing every time: "Document2 - Word", "Document3 - Word", etc.
Also tried *Word but looks like this func does not support wildcards
If I invoke:
List windows = application.GetWindows();
after launching an application, windows list is empty.
Thanks in advance,
Ostap
You can use EnumWindows to find all the open windows.
Within that callback you'll get a window handle which you can then us with GetWindowTextLength and GetWindowText
This will let you decide what window handle is to the window you want. From there you can use GetWindowThreadProcessId to retrieve the process ID for the word document.
And finally with that you can create a TestStack White application using the Application.Start()
It looks like opening window takes some noticeable time. GUI testing frameworks often have functions like Wait() to make sure the window is already created/visible/enabled. I'm not an expert in Teststack.White. Probably this document may help: http://teststackwhite.readthedocs.io/en/latest/AdvancedTopics/Waiting/

Related Links

uiautomator runs multiple tests on multiple devices?
How to link multiple columns to 1 variable in Data driven automation of ranorex
Is there a WebDriver implementation for Microsoft UI Automation (UIA)?
CodedUI test - can't send plain text password into input field
Is it possible to access lock screen elements with iOS UIAutomation?
How to find Window by variable title using TestStack.White framework?
How can I Implement a dynamic timeout in Teststack White?
How to specify Contains in UI Automation PropertyCondition
Exe create for UI automation using Teststack.white does not run when scheduled using Windows Task scheduler
White/UI Automation doesn't recognize the container (pane control) in tab
How to get descendants of a panel in teststack.white
Microsoft UI Automation: Invoke Pattern Exception
System.Windows.Forms.ListView Check box is not recognized by UIA verrify
UISearchDisplayController and UIAutomation
Handle UI Automation Mouse and Keyboard events
Add CodedUI to Test Manager

Categories

HOME
android-espresso
apache-nifi
angular-ui-grid
eclipse-plugin
opencv-python
swi-prolog
systemd
out-of-memory
iverilog
cryptography
header
ipv6
haxe
minecraft
specifications
cisco
driver
chromecast
smooks
smartgwt
webstore
nullreferenceexception
jest
angular2-highcharts
restier
pyopencl
opentext
tracing
python-imageio
adapter
laravel-4.2
instructions
listjs
ms-media-foundation
express-session
djcelery
grunt-contrib-watch
vb.net-to-c#
angular-datatables
hypothesis-test
robust
httphandler
moinmoin
jshint
music21
entropy
polymaps
pecl
zend-server
rustdoc
oid
yargs
cocoa-bindings
streamwriter
tablespace
decoder
nvda
traversable
maximize
timestamping
pack
bayesglm
bjam
quercus
r.java-file
fiware-bosun
tkx
nhibernate-criteria
dos2unix
microsoft-expression-web
n-tier-architecture
flurry-analytics
iodocs
git-reset
xmi
property-injection
spring-security-acl
jquery-lazyload
delphi-xe4
examine
ip-geolocation
nsmutablestring
java.lang.class
fitch-proofs
wiktionary
infopath-2007
qt-mobility
fork-join
directshow.net
suphp
android-2.1-eclair
rawcontacts
version-control-migration
rendering-engine

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App