Is there a way how to open a dropdown and select an item using Selenium WebDriver and Python? Could you write an example? DomID used.
If you are leveraging the ignition-automation-tools repo that we have made available, then you would do something like the following:
from Components.PerspectiveComponents.Inputs.Dropdown import Dropdown
_DROPDOWN_LOCATOR = (By.ID, 'a464....')
_option = '{option you want selected}'
_dropdown = Dropdown(locator=_DROPDOWN_LOCATOR, driver=driver)
_dropdown.select_option_by_text_if_not_selected(option_text=_option)
To allow your repo to work with ours, you would leverage the PYTHONPATH
environment variable when running the test. The syntax would look like (assuming a Linux based OS):
export PYTHONPATH={Path to your Python Test}:{Path to the ignition-automation-tools workspace}
e.g.
export PYTHONPATH=/PycharmProjects/ExampleFramework/TestSuite:/git/ignition-automation-tools
Garth
4 Likes
Thank you a lot. It really looks pretty time-saving!
A post was split to a new topic: Providing domId for use in EmbeddedView
Hi, is there a plan to publish this library in PiPY so one can install it with pip into a project?
Not at this time, no - although the only real obstacle is probably our regular workload. We'll look into what might need to be done for this to determine feasibility.
1 Like