Most of software testers are familiar with the term "Changing proxy settings" :P .
The only reason ( atleast for me :P ) we change browser proxy settings is to verify "multilingual" and "multi-regional" websites .
If business is happened to spread in multiple countries then website has to offer content in more than one language.But it is always not so easy to test "multi-regional" websites.Sometimes we have to change the proxy settings of browser to verify the functionality.
Say if you directly access the bwin.com from India then we will get redirecte to http://help.bwin.com/closed and we will see the below page.
But if you access the same bwin.com site from United States then you will see the below page.
Manually if we want to test this functionality then we will get proxy server details from online and change our browser proxy settings , before accessing the site from our browser.
But if we want to verify the same functionality through automation , then we must know way using which we can modify the proxy server settings of browser . And here is the sample program to do that :)
And last but not the least ,
Advance Happy New Year ..!! Have fun :)
The only reason ( atleast for me :P ) we change browser proxy settings is to verify "multilingual" and "multi-regional" websites .
- A multilingual website is any website that offers content in more than one language (Facebook) .
- A multi-regional website is one that explicitly targets users in different countries (Bwin).
If business is happened to spread in multiple countries then website has to offer content in more than one language.But it is always not so easy to test "multi-regional" websites.Sometimes we have to change the proxy settings of browser to verify the functionality.
Say if you directly access the bwin.com from India then we will get redirecte to http://help.bwin.com/closed and we will see the below page.
But if you access the same bwin.com site from United States then you will see the below page.
Manually if we want to test this functionality then we will get proxy server details from online and change our browser proxy settings , before accessing the site from our browser.
But if we want to verify the same functionality through automation , then we must know way using which we can modify the proxy server settings of browser . And here is the sample program to do that :)
import java.io.IOException; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxProfile; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; public class ProxySettings { WebDriver driver; String serverIP=199.201.125.147; String port=199.201.125.147; @BeforeTest public void setUpDriver() { FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("network.proxy.type",1); profile.setPreference("network.proxy.ftp",serverIP); profile.setPreference("network.proxy.http",serverIP); profile.setPreference("network.proxy.socks",serverIP); profile.setPreference("network.proxy.ssl",serverIP); profile.setPreference("network.proxy.ftp_port",port); profile.setPreference("network.proxy.http_port",port); profile.setPreference("network.proxy.socks_port",port); profile.setPreference("network.proxy.ssl_port",port); driver = new FirefoxDriver(profile); } @Test public void start() throws IOException{ driver.get("https://www.bwin.com/"); driver.findElement(By.id("username")).sendKeys("MyUserName"); driver.findElement(By.id("password")).sendKeys("MyTestPassword"); driver.findElement(By.name("submit")).click(); } }
And last but not the least ,
Advance Happy New Year ..!! Have fun :)
HI Vamshi,
ReplyDeleteyour post are very helpful and it will be nice if u write a post on Ghost driver .
Hey Hi,
ReplyDeleteI know I am little to reply.
You must switch to the popup (overlay) before performing drag and drop operation.
Hi Vamshi,
ReplyDeleteCan i select text from the document using selenium webdriver?
Thanks,
Akash Gupta
vamshi sir,
ReplyDeletehi
i had follow ur mention abow step but still error is coming plz help me
Error : Exception in thread "main" java.lang.UnsatisfiedLinkError: no AspriseOCR in java.library.path
giving me error org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"draggable"}
ReplyDeleteCommand duration or timeout: 251 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: 'admin-HP', ip: '192.168.1.146', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0'
Session ID: 722d5004-5abd-41f8-9c22-e9e5926902a8
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotatable=false, locationContextEnabled=true, version=23.0, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, browserConnectionEnabled=true, nativeEvents=false, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}]
Did you add AspriseOCR.dll file at C:\Windows\System32 ?
ReplyDeleteHi Akash,
ReplyDeleteRight now I don't have any thing in mind using which will just highlight the text on webpage using webdriver.
But if you want to verify a particular text from document in the webpage , you can always do it by checking the source code of webpage .
Hi Vamshi,
ReplyDeleteNo problem i will manage it.
And thank you so much for giving me your best time.
Thanks,
Akash Gupta.
Hey
ReplyDeleteIf you happened to find any work around share with me .
Is it possible to get text from captcha image using above method
ReplyDeleteHi Vamsi Kurra,I was searching for information on testng.xml information and I found this article.Thank You.Wonderful Stuff.One small favor though.Can you provide us more details about testng.xml file with detailed description(like,
ReplyDeletein beforeSuite,in beforeTest,in beforeClass,in beforeMethod...etc) and an example with the order of execution of the testng Annotations.Thank You.
Hi vamshi,
ReplyDeleteAll together is a nice stuff................i am unable to read .png image but i can able to read .jpg image........so please help me out with your idea.
Can you share the image you are trying ?
ReplyDeleteHi Vashmi,
ReplyDeleteThankz for nice post. I am verifying the text of .png image. The problem with my script is that it is getting stopped at image =ImageIO.read(url);
String s = new OCR().recognizeCharacters((RenderedImage) image);
and taking too much time to execute forward. Please suggest if you have any solution.
Hi Pankaj,
ReplyDeleteJust want to confirm did you copy all the DLL files ( ASpireOCr.dll , DEVIL and iLU DLL) to system32 folder ?
Also did you add the aspireOCr jar file to eclipse external jar?
Oh , also as we are using free version , we will get external alert while running the script. Just confirm that alert so that the script will go smooth.
ReplyDeleteHi Vamshi,
ReplyDeleteI added the "AspriseOCR.dll" at "C:\Windows\System32", but it also point out "java.lang.UnsatisfiedLinkError: no AspriseOCR in java.library.path" Exception.
I also tried many methods but all failed.
1. I tried add all the dll files in the asprise file to system32, but failed.
2. I also added the location of asprise to "environment variables".
3. Add vmargs to Eclipse.ini, such as "launcher.library" and "-Djava.library.path".
Finally, I import the dll files into the project in Eclipse, then it works.
Could you please tell me how to resolve it with the "system32"?
Thank you.
hai,
ReplyDeletecan i select the image displayed on the gmail account creating page .ie, the security image that is displayed on the account creation page? using this code?
Thank for your post,
ReplyDeleteI follow your post, but it doesn't work, when I go to http://www.whatismyip.com/, my ip doesn't change
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.type",1);
profile.setPreference("network.proxy.ftp",serverIP);
profile.setPreference("network.proxy.http",serverIP);
profile.setPreference("network.proxy.socks",serverIP);
profile.setPreference("network.proxy.ssl",serverIP);
profile.setPreference("network.proxy.ftp_port",port);
profile.setPreference("network.proxy.http_port",port);
profile.setPreference("network.proxy.socks_port",port);
profile.setPreference("network.proxy.ssl_port",port);
driver = new FirefoxDriver(profile);
driver.get("http://www.whatismyip.com/");