YueChen-C / py-ios-device

IOS Professional Performance Testing Tool . You can get CPU, GPU, Memory , Lifecycle and other metrics from real iOS devices . iOS 性能测试工具
GNU General Public License v3.0
667 stars 183 forks source link

[appium][installCertificate] driver execute_script downloads certificate but not installing it #81

Closed bwomsm1 closed 1 year ago

bwomsm1 commented 1 year ago

I am trying to install certificate with the following code:

        cer = '-----BEGIN CERTIFICATE-----rOFP9NZCKjpHxiP1EgbZ7Aj8OfTTXMHYzhVejNK6LBS2X-----END CERTIFICATE-----'
        message_bytes = cer.encode('ascii')
        base64_bytes = base64.b64encode(message_bytes)
        base64_message = base64_bytes.decode('ascii')

       response = self.driver_.execute_script(
            'mobile: installCertificate', {"content": base64_message}
        )

The action does working correctly and I am able to see that message on my iPhone device: Screenshot 2022-12-12 at 10 34 05

But it does not really help me in my scenario since that the profile is only being downloaded but not installed, in order to install I need to got to the iPhone settings and install the downloaded certificate manually

Expected Behavior

certificate should be downloaded and installed

Minimal Reproducible Example

        cer = '-----BEGIN CERTIFICATE-----rOFP9NZCKjpHxiP1EgbZ7Aj8OfTTXMHYzhVejNK6LBS2X-----END CERTIFICATE-----'
        message_bytes = cer.encode('ascii')
        base64_bytes = base64.b64encode(message_bytes)
        base64_message = base64_bytes.decode('ascii')

       response = self.driver_.execute_script(
            'mobile: installCertificate', {"content": base64_message}
        )

Link to Appium Logs

https://github.com/bwomsm1/AppiumLogs/blob/master/certificate.log

bwomsm1 commented 1 year ago

@YueChen-C can you please help with that issue? Thanks!

YueChen-C commented 1 year ago

I haven't found a better way. Installing the certificate requires very high system permissions

bwomsm1 commented 1 year ago

thanks @YueChen-C for your response. Can we say that install is currently not supported with this tool?

pimterry commented 1 year ago

@bwomsm1 I'm also hitting this issue. If you find any way to automatically install a certificate like this, with py-ios-device or any other tool, do please share it here!

bwomsm1 commented 1 year ago

Thanks, I will.