We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
Just to follow up. I rewrote the test to use dropdown and choose that is fetched:
#Selects the 'Gemalto USB Smart Card Reader 1' item of the 'ComboboxOperatorCardReader' combo box.
reader = "Gemalto USB Smart Card Reader"
app.MainWindow.TabControl2.TabControlConfig.ItemsControl.ComboboxOperatorCardReader.Click()
ComboBox = app.MainWindow.TabControl2.TabControlConfig.ItemsControl.ComboboxOperatorCardReader
for i in range(ComboBox.wItemCount):
Item = aqString.GetListItem(ComboBox.wItemList, i)
if reader in Item:
Log.Message(f"found {Item}")
app.MainWindow.TabControl2.TabControlConfig.ItemsControl.ComboboxOperatorCardReader.ClickItem(Item)
break
reader = "Gemalto IDBridge CT7xx"
ComboBox = app.MainWindow.TabControl2.TabControlConfig.ItemsControl.ComboboxOperatorCardReader
# focus object missing name, Accessibility Insight gives error
ComboBox.Click(335, 13)
Sys.Keys("[Tab]")
for i in range(ComboBox.wItemCount):
Item = aqString.GetListItem(ComboBox.wItemList, i)
if reader in Item:
Log.Message(f"found {Item}")
app.MainWindow.TabControl2.TabControlConfig.ItemsControl.ComboboxOperatorCardReader.ClickItem(Item)
break
But in selenium try/except catches everything, must easier with exception handling.
Hi,
> it always fails.
More details as for your definition of 'fails', please? Error message from the test log if exists.
> app.MainWindow.[...].ComboboxOperatorCardReader.ClickItem(...)
As long as the ComboboxOperatorCardReader object exists and is of combo-box type (or any other object type that provides .ClickItem() method) no exception is expected here.
Exception is a critical failure of the code been executed. In your case, code can be executed without failure. But the certain item might not exists and thus cannot be clicked. In this case you will get an error in the test log, but this is not a reason for exception throwing.
What you need to do is check first if the required item to be clicked exists and proceed appropriately.