-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parallel usage results in a "socket hang up" error. systemPort have set but still have the problem. #903
Comments
The error information is as follows: |
Could you share the appium log as well? (as GIST) |
Ok,bro. This is the link:https://gist.github.com/Underson888/8871bca07b3241d7aa6f810e9a7bc16c |
Did they work with a single thread? The port config itself looks working |
Yes,each device is controlled by a single thread,just like the code mentioned. |
thread1 = threading.Thread(target=run_test_on_device, args=(desired_caps1,)) thread1.start() thread1.join() Is it correct for the driver? |
I understand that the question was asked a long time ago. But maybe I can help someone with my comment. At least it would have been very useful to me earlier. I reduced the number of nodes for text compression and changed some variables (for example, username and IP addresses) File structure
gitlab-ci.yml
hub.service
appium-1.service
appium-1.yml
appium-2.service
appium-2.yml
node-1.service
node-1.toml
node-2.service
node-2.toml
Usageimport time
from appium import webdriver
from appium.options.android import UiAutomator2Options
from appium.webdriver.webdriver import WebDriver
base_url = 192.168.0.12 # Remote adress of appium hub
options = UiAutomator2Options()
options.udid = "123456789099999"
driver = webdriver.Remote(command_executor=f"http://{base_url}:3334",
options=options)
time.sleep(3)
driver.quit() |
Here's my code:
python
from appium import webdriver
from appium.webdriver.common.touch_action import TouchAction
import threading
Device 1's configuration
desired_caps1 = {
"appium:appActivity": ".Settings",
"appium:appPackage": "com.android.settings",
"appium:automationName": "uiautomator2",
"appium:udid": "xxxx",
"platformName": "Android",
"appium:systemPort": 8310
}
Device 2's configuration
desired_caps2 = {
"appium:appActivity": ".Settings",
"appium:appPackage": "com.android.settings",
"appium:automationName": "uiautomator2",
"appium:udid": "192.168.137.58:5555",
"platformName": "Android",
"appium:systemPort": 8322
}
def run_test_on_device(desired_caps):
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps) # Corrected URL
Use threading for parallel execution
thread1 = threading.Thread(target=run_test_on_device, args=(desired_caps1,))
thread2 = threading.Thread(target=run_test_on_device, args=(desired_caps2,))
thread1.start()
thread2.start()
thread1.join()
thread2.join()
I have set the different systemPort for each devices, but I still have the problem.
How can I sove that, I'm very need to be solved, thanks.
The text was updated successfully, but these errors were encountered: