Hello,
Thanks to your helps, I have managed to run some tests.
My situtation is little bit uncommon since I need to all the test with real devices.
So my original code was like this
Device 1: send message for a certain period
Device 2: read pop-up window 10 seconds after the device 1 send a message and evaluate the value.
And I wanted to expand my test so I added a code for one more recieving device like below
capabilities1 = dict(
platformName=‘Android’,
automationName=‘uiautomator2’,
udid=‘DID1’,
newCommandTimeout=20
)
capabilities2 = dict(
platformName=‘Android’,
automationName=‘uiautomator2’,
udid=‘DID2’, # replace this with the actual UDID of the second device
newCommandTimeout=20
)
capabilities3 = dict(
platformName=‘Android’,
automationName=‘uiautomator2’,
udid=‘DID3’, # replace this with the actual UDID of the second device
newCommandTimeout=20
)
appium_server_url = ‘http://localhost:4723’
class TestAppium(unittest.TestCase):
def setUp(self) -> None:
self.driver1 = webdriver.Remote(appium_server_url, capabilities1)
self.driver2 = webdriver.Remote(appium_server_url, capabilities2)
self.driver3 = webdriver.Remote(appium_server_url, capabilities3)
…
I also duplicate the code for window anaysis and change all the numbers accordingly(ex: self.driver3.)
window_elements = self.driver2.find_elements(by=AppiumBy.ID, value=“appname:id/btn_window”)
for el in window_elements:
if el.text == "text1":
self.count_green_1 += 1
elif el.text == "text2.":
self.count_yellow_1 += 1
elif el.text == "text3":
self.count_unknown_1 += 1
elif el.text == "text4":
self.count_red_1 += 1
# Check for the presence of the image element and increase the count if it's present
image_elements = self.driver2.find_elements(by=AppiumBy.ID, value="appname:id/apssp_native_ad_main_image1")
if len(image_elements) > 0:
self.count_image_1 += 1
# Print the current counts to the terminal
print(f'receiver 1 window: {self.count_tv_info_1}, ad: {self.count_view_advertisement_1}, image: {self.count_image_1}, green: {self.count_green_1}, yellow: {self.count_yellow_1}, red: {self.count_red_1}, grey: {self.count_unknown_1}')
but nothing happens and the terminal says that they passed the test.
It does that even when the appium server is not running.
Any advice please?