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

plraymondplraymond Members
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

Sign In or Register to comment.