Please note that Sahi's development and support teams do not actively monitor this. This is more a community forum. If you are a Sahi Pro user looking for commercial support, please email support @ sahipro.com with your query.

Mobile testing with Sahi

Recently I have struggled a bit trying to test a web application using a mobile device user agent with Sahi. Eventually I found out that chrome would accept a change of user agent as a command line argument. I tried to add the --user-agent argument to my chrome batch file using different user agent strings without much success. I noticed that the user agent strings used semicolons or commas as delimiters, it seems that these delimiters were in conflict with java. So I tried to replace the delimiters with a dot ('.'). I also replaced all spaces in my user agent string with dots. Here's what my Browser Options line looks like:

SET BROWSER_OPTION=--user-data-dir=$userDir\browser\chrome\profiles\sahi$threadNo --proxy-server=localhost:9999 --disable-popup-blocking --user-agent="Mozilla/5.0.(iPhone.U.CPU.OS.3_2.like.Mac.OS.X.en-us).AppleWebKit/531.21.10.(KHTML.like.Gecko).Version/4.0.4.Mobile/7B334b.Safari/531.21.10"

And it worked ! I am now able to test my web application as if I was using an iPhone.

Hope this is as helpful for you as it was for me !

Comments

  • Hi Raymond,

    This definitely helps! Thanks for sharing.

    Regards,
    Narayan
  • Hi ,
    can you tell we where exactly to change the property for adding user agent.

    Thanks,
    Bhaswanth
  • Hi Narayan

    How to record mobile apps script using SAHI (Not on the i-Phone or mobile)

    Thanks

  • **********************************
    HI all,
    I am trying to run scripts on iphone6s/6s+ , however I couldn't, As I successfully done for iphone5/5c
    Could you plz let me know as i need on urgent basis.

    Is sahi compatible to playback on latest versions of iphone and android.?????????

    ****************************************
Sign In or Register to comment.