Skip to content

Unable to run WebDriverAgent via fbsimctl on real devices #446

Open

Description

@aristeia

Hi,
I have multiple Macs with multiple idevices available to me to run WebDriverAgent via the fbsimctl framework. After custom installing it by cloning the FBSimulatorControl repo, brew installing carthage, and running the ./build.sh fbsimctl build output command. I can successfully run the fbsimctl command line tool. Likewise, after building WebdriverAgent with the following command, I'm able to use the xctest output as an argument for fbsimctl:

security unlock-keychain -p $my_password ~/Library/Keychains/login.keychain
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner build

However, after booting a simulator and re-running the unlock-keychain command, I get the following error when trying to run com.apple.mobilesafari:

jenkins$ ./fbsimctl --debug-logging F267E6B7-D8EF-4E81-93C0-6218FD28A7FC launch_xctest /Users/jenkins/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest com.apple.mobilesafari --port 8090 -- listen
Overriding the Default Logger with <LogReporter: 0x7fdea3d61750>
CoreSimulator: Loading from /Applications/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework 
CoreSimulator: Successfully loaded
CoreSimulator: SimDevice has correct path of /Applications/Xcode.app
Loaded All Private Frameworks [CoreSimulator]
Completed Pool Preconditons
MobileDevice: Loading from /System/Library/PrivateFrameworks/MobileDevice.framework 
MobileDevice: Successfully loaded
Loaded All Private Frameworks [MobileDevice]
DTXConnectionServices: Loading from /Applications/Xcode.app/Contents/SharedFrameworks/DTXConnectionServices.framework 
DTXConnectionServices: Successfully loaded
DTXConnectionServices: DTXConnection has correct path of /Applications/Xcode.app
DTXConnectionServices: DTXRemoteInvocationReceipt has correct path of /Applications/Xcode.app
XCTest: Loading from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework 
XCTest: Successfully loaded
XCTest: XCTestConfiguration has correct path of /Applications/Xcode.app
Loaded All Private Frameworks [DTXConnectionServices, XCTest]
Application Did Launch => Process MobileSafari | PID 21261
F267E6B7-D8EF-4E81-93C0-6218FD28A7FC | iPhone SE | Booted | iPhone SE | iOS 10.3 | x86_64: launch: Process MobileSafari | PID 21261
Connecting Test Bundle
Creating the test bundle connection.
Listening for proxy connection request from the test bundle (all platforms)
Resuming the test bundle connection.
Checking test manager availability...
Starting test session with ID 33A61E9B-ADB1-4934-898A-EF947E8D2F45
Application Did Terminate => Expected 0 Process MobileSafari | PID 21261
F267E6B7-D8EF-4E81-93C0-6218FD28A7FC | iPhone SE | Booted | iPhone SE | iOS 10.3 | x86_64: terminate: Process MobileSafari | PID 21261
Error Domain=com.facebook.FBSimulatorControl Code=0 "Failed start test manager" UserInfo={NSLocalizedDescription=Failed start test manager, NSUnderlyingError=0x7fdea3dbd450 {Error Domain=com.facebook.FBControlCore Code=0 "Timed out waiting for future Future running in 30.000000 seconds" UserInfo={NSLocalizedDescription=Timed out waiting for future Future running in 30.000000 seconds}}}

With real devices, I get an even more basic issue at the level of an error in Swift:

jenkins$ ./fbsimctl --debug-logging f6d0770375288a9dc49c70746221ddc0bcb2fca8 launch_xctest /Users/jenkins/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest com.apple.mobilesafari --port 8090 -- listen
Overriding the Default Logger with <LogReporter: 0x7fcb5b405300>
CoreSimulator: Loading from /Applications/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework 
CoreSimulator: Successfully loaded
CoreSimulator: SimDevice has correct path of /Applications/Xcode.app
Loaded All Private Frameworks [CoreSimulator]
Completed Pool Preconditons
MobileDevice: Loading from /System/Library/PrivateFrameworks/MobileDevice.framework 
MobileDevice: Successfully loaded
Loaded All Private Frameworks [MobileDevice]
2017-09-19 15:09:43.089 fbsimctl[39952:74802699] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fffc656e2cb __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fffdb37948d objc_exception_throw + 48
	2   CoreFoundation                      0x00007fffc646b3f0 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 352
	3   CoreFoundation                      0x00007fffc646b25b +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
	4   XCTestBootstrap                     0x00000001056bb327 +[FBXcodeBuildOperation xctestRunProperties:] + 599
	5   FBDeviceControl                     0x0000000104c1428d -[FBDeviceXCTestCommands createXCTestRunFileFromConfiguration:error:] + 285
	6   FBDeviceControl                     0x0000000104c13ac1 -[FBDeviceXCTestCommands startTestWithLaunchConfiguration:reporter:error:] + 625
	7   FBControlCore                       0x0000000104c944ae -[FBTestLaunchConfiguration runWithTarget:delegate:error:] + 302
	8   FBSimulatorControlKit               0x00000001048897db _TFE21FBSimulatorControlKitPSo17FBiOSTargetAction9runActionfzT6targetPSo11FBiOSTarget_8reporterPS_13EventReporter__GSqPSo19FBTerminationHandle__ + 251
	9   FBSimulatorControlKit               0x0000000104860264 _TFZFV21FBSimulatorControlKit15iOSTargetRunner4coreFTPS_11iOSReporter_GSqVSC21FBiOSTargetActionType_PSo11FBiOSTarget_PSo17FBiOSTargetAction__S0_U_FzT_GSqPSo19FBTerminationHandle__ + 180
	10  FBSimulatorControlKit               0x00000001048605ca _TFV21FBSimulatorControlKit15iOSTargetRunner3runfT_VS_13CommandResult + 490
	11  FBSimulatorControlKit               0x0000000104860bda _TTWV21FBSimulatorControlKit15iOSTargetRunnerS_6RunnerS_FS1_3runfT_VS_13CommandResult + 330
	12  FBSimulatorControlKit               0x0000000104871e88 _TFV21FBSimulatorControlKit18DeviceActionRunner3runfT_VS_13CommandResult + 2648
	13  FBSimulatorControlKit               0x0000000104872e50 _TTWV21FBSimulatorControlKit18DeviceActionRunnerS_6RunnerS_FS1_3runfT_VS_13CommandResult + 848
	14  FBSimulatorControlKit               0x000000010489b08e _TFV21FBSimulatorControlKit14SequenceRunner3runfT_VS_13CommandResult + 798
	15  FBSimulatorControlKit               0x00000001048f8068 _TFV21FBSimulatorControlKit12ActionRunner3runfT_VS_13CommandResult + 14040
	16  FBSimulatorControlKit               0x00000001048f1638 _TFV21FBSimulatorControlKit13CommandRunner3runfT_VS_13CommandResult + 3896
	17  FBSimulatorControlKit               0x00000001048f015d _TFV21FBSimulatorControlKit17BaseCommandRunner3runfT_VS_13CommandResult + 2557
	18  FBSimulatorControlKit               0x000000010481c3a3 _TFV21FBSimulatorControlKit9CLIRunner3runfT_VS_13CommandResult + 2163
	19  FBSimulatorControlKit               0x000000010481a759 _TFV21FBSimulatorControlKit9CLIRunner12runForStatusfT_Vs5Int32 + 41
	20  FBSimulatorControlKit               0x00000001048177db _TZFC21FBSimulatorControlKit15CLIBootstrapper9bootstrapfT_Vs5Int32 + 2683
	21  FBSimulatorControlKit               0x000000010481b419 _TToZFC21FBSimulatorControlKit15CLIBootstrapper9bootstrapfT_Vs5Int32 + 25
	22  fbsimctl                            0x0000000104801568 main + 56
	23  libdyld.dylib                       0x00007fffdbc5e235 start + 1
	24  ???                                 0x000000000000000a 0x0 + 10
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

During neither of these errors am I able to access the WDA server at localhost:8090. Why might these be happening?

Activity

  1. changed the title [-]Unable to run WebDriverAgent via fbsimctl on either real devices or emulators[/-] [+]Unable to run WebDriverAgent via fbsimctl on real devices[/+] on Sep 19, 2017
  2. aristeia commented on Sep 19, 2017

    @aristeia
    Author

    EDIT: I figured out the emulator devices issue. By passing in something into the destination of the xcodebuild command (like one of the idevice's udids), the WebDriverAgent build began to work:

    jenkins$ xcodebuild -project WebDriverAgent.xcodeproj            -scheme WebDriverAgentRunner      -destination "id=f6d0770375288a9dc49c70746221ddc0bcb2fca8"      build
    

    Output from fbsimctl:

    jenkins$ ./fbsimctl --debug-logging F267E6B7-D8EF-4E81-93C0-6218FD28A7FC launch_xctest /Users/jenkins/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest com.apple.mobilesafari --port 8095 -- listen
    Overriding the Default Logger with <LogReporter: 0x7faaa1e3f6a0>
    CoreSimulator: Loading from /Applications/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework 
    CoreSimulator: Successfully loaded
    CoreSimulator: SimDevice has correct path of /Applications/Xcode.app
    Loaded All Private Frameworks [CoreSimulator]
    Completed Pool Preconditons
    MobileDevice: Loading from /System/Library/PrivateFrameworks/MobileDevice.framework 
    MobileDevice: Successfully loaded
    Loaded All Private Frameworks [MobileDevice]
    DTXConnectionServices: Loading from /Applications/Xcode.app/Contents/SharedFrameworks/DTXConnectionServices.framework 
    DTXConnectionServices: Successfully loaded
    DTXConnectionServices: DTXConnection has correct path of /Applications/Xcode.app
    DTXConnectionServices: DTXRemoteInvocationReceipt has correct path of /Applications/Xcode.app
    XCTest: Loading from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework 
    XCTest: Successfully loaded
    XCTest: XCTestConfiguration has correct path of /Applications/Xcode.app
    Loaded All Private Frameworks [DTXConnectionServices, XCTest]
    Application Did Launch => Process MobileSafari | PID 49383
    F267E6B7-D8EF-4E81-93C0-6218FD28A7FC | iPhone SE | Booted | iPhone SE | iOS 10.3 | x86_64: launch: Process MobileSafari | PID 49383
    Connecting Test Bundle
    Creating the test bundle connection.
    Listening for proxy connection request from the test bundle (all platforms)
    Resuming the test bundle connection.
    Checking test manager availability...
    Starting test session with ID B8C7865A-6074-4924-A161-2A59FB7D410C
    testmanagerd handled session request using protcol version 22.
    Got proxy channel request from test bundle
    Test bundle is ready, running protocol 22, requires at least version 8. IDE is running 22 and requires at least 8
    Test Bundle is Ready
    _XCT_testBundleReadyWithProtocolVersion:minimumVersion:
    Starting the daemon connection
    Resuming the daemon connection.
    Whitelisting test process ID 49383
    Got whitelisting response and daemon protocol version 22
    Ready to execute test plan
    TestManager Did Connect => TestManager Awaiting Result for (Test Host PID 49383 | Test Host Bundle com.apple.mobilesafari | Session ID B8C7865A-6074-4924-A161-2A59FB7D410C)
    Bundle Connection scheduling start of Test Plan
    Daemon Notified of start of test plan
    listen started: Http: No Hid: No stdin: false
    Test Plan Started
    _XCT_didBeginExecutingTestPlan
    Started initilizing for UI testing.
    _XCT_testSuite:didStartAt:
    _XCT_testSuite:didStartAt:
    _XCT_testSuite:didFinishAt:runCount:withFailures:unexpected:testDuration:totalDuration:
    _XCT_testSuite:didStartAt:
    _XCT_testSuite:didStartAt:
    _XCT_testCaseDidStartForTestClass:method:
    
    

    However, real devices still encounter that error.

  3. gu-wei commented on Sep 25, 2017

    @gu-wei

    any update or any plan to support launching WDA on real devices?

  4. aristeia commented on Sep 26, 2017

    @aristeia
    Author

    WDA can run on real devices just fine, such as through xcodebuild with the test flag at the end. My issue is running WDA via fbsimctl on real devices.

  5. mskmkt0704 commented on Mar 14, 2018

    @mskmkt0704

    You can look at #345

  6. zeyadsalloum commented on May 7, 2019

    @zeyadsalloum
    Contributor

    We just released idb. which has support for both simulators and devies. We recommend switching over. As part of our renewed commitment to this repo we are cleaning up old issues and will be monitoring and reviewing more closely from now on. if you still think this issue is relevant feel free to reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions