Selenium Remote Control (RC) is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser. Selenium RC is great for testing complex AJAX-based web user interfaces under a Continuous Integration system. It is also an ideal solution for users of Selenium IDE who want to write tests in a more expressive programming language like Java,Perl etc.
Selenium IDE is much simpler and can be used only on firefox. Selenium RC lets you to write much complex scripts using the programming language features. And you can mention the browser on which you want to run the script. Selenium RC supports Internet Explorer, firefox, googlechrome etc.
You can use any IDE for developing your scripts but I like using Eclipse. I will be explaining later how to use Eclipse.
Ok...so lets start creating the Selenium RC script using TestNG. You will need to install the following first.
Install the below
1. JDK : You can be download it from here http://java.sun.com/javase/downloads/index.jsp. Set the classpath.
2. Selenium RC: Download it from here: http://seleniumhq.org/download . Extract the files in a folder named SeleniumRC and rename the selenium-server to JavaServer (it would be easy for us to use later).
3. TestNG : Download TestNG from http://testng.org/doc/download.html. Unzip. The files will get extracted to a folder called testng.
4. Eclipse : Download eclipse from http://www.eclipse.org/downloads/.Choose the "Eclipse IDE for Java Developers".Unzip the downloaded file. The files will get extracted to a folder called 'eclipse'.
5. TestNG plug-in for Eclipse: Start Eclipse by clicking the eclipse icon in the eclipse folder that's mentioned earlier. Click on Help->Install New Softwares. Enter "http://beust.com/eclipse/" in the "Work With:" and press Enter. You should see TestNG. Select it and then press Next till you reach Finish. Restart Eclipse.
Good that we have finished installing everything that we needed to start with selenium and TestNG. You could always work with selenium and testng without eclipse in which case you wont have to install Eclipse and the TestNG plug-in required for eclipse. But its better to have an IDE (like Eclipse or anyother) so that its far easier to write the scripts.
Let's start with the SeleniumRC and TestNG script now:
1. Open eclipse. Start by creating a new project : File->New->Java Project. Give a name say 'Automation'.
2. Add the required jars. Select the project-'Automation' , right click Build Path->Configure Build Path. Click Libraries->Add External Jars. You will have to add the testng and selenium jars.
3. Create a new package in the project. Select the project -'Automation' and then right click New->Package. Give a name say 'First'.
4. Create a new java program. Select the package-'First' and then right click New->Class. Enter the name as say 'GoogleSearchTC'.Press Enter.
5. Now go to Selenium IDE and open the 'google.html' script which we had created in our first blog- 'Starting with Selenium IDE'. Click on Options->Format->Java(TestNG)Selenium. You can see that the format of your test case is now changed.
The format is in the testng format now. Your script would look like below:
6. Copy paste the whole code into eclipse(GoogleSearchTC). You can see some errors.
7. Make changes so that your testng script looks like below:
Great!!!!! Your first testng script is ready to be run. Wasnt that easy?
8. Start your selenium server. Go to command prompt and then go to SeleniumRC/JavaServer folder (where you installed selenium rc). Type in
java -jar selenium-server.jar -port 1234
This is assuming that the port 1234 is free. You can give any other port number if 1234 is being used. Just ensure that the port num given in the testng script matches with the port num used to bring up the selenium server.
Your command prompt screen should look something like below:
Your selenium server is up and running now.
9. Now run the testng script by going back to eclipse. Right click on the testng script. Click RunAs->TestNG Test.
Your script should run successfully.
excellent tutorial! really clear!
ReplyDeleteI am a tester myself and I want to start running my selenium tests with testng, had really hard time finding tutorials for beginners like me
I have followed the exact instructions with out any issue. But after I recorded and formatted the script into TestNG format and then I copy and paste the whole code into Eclipse it prompts so many errors. Is there is a way to fix all those errors.
ReplyDeleteThe given below code is the one I retrieved after I formatted it. But once I copy and paste it to Eclipse it prompts so many errors. There for I am unable to exeucte it a s TestNG. Please appreciate your response. Advice me why I get a error in Eclipse and how to fix it.
TestNG script.
import com.thoughtworks.selenium.*;
import org.testng.annotations.*;
import static org.testng.Assert.*;
import java.util.regex.Pattern;
public class cap extends SeleneseTestNgHelper {
@Test public void testCap() throws Exception {
selenium.open("about:home");
selenium.type("id=searchText", "cap");
selenium.click("id=searchSubmit");
selenium.waitForPageToLoad("30000");
selenium.click("link=Cap (sport) - Wikipedia, the free encyclopedia");
selenium.waitForPageToLoad("30000");
}
}
Thanks for this useful information. IntelliMindz is the best IT Training in Bangalore with placement, offering 200 and more software courses with 100% Placement Assistance.
DeleteSelenium Online Course
Selenium Training In Bangalore
Selenium Training In Chennai
Selenium Training In Coimbatore
Selenium Training In Tirupur
Thanks for your informative post; selenium is portable automation testing tool to validate the performance and behavior of a software application or environment. Best Selenium training institute in Chennai
ReplyDelete
ReplyDeleteHi, probably our entry may be off topic but anyways, I have been surfing around your blog and it looks very professional. It’s obvious you know your topic and you appear fervent about it.Thanks for the forum posting..
Mobile Application Development and Testing Training
Thanks for share this information. I have read your blog. Your information is really helpful for me. Keep update your blog. I did Selenium training in Chennai at Besant technologies. It’s very useful for me to know more about selenium.
ReplyDeleteThanks for share this information.
ReplyDeleteSCM training in chennai
Greens Technology's the leading software Training & placement centre Chennai & ( Adyar)
ReplyDeleteselenium training in chennai
Thanks for your informative post on selenium automation testing tool.
ReplyDeletesas training in chennai
Its really nice appreciated article with screenshot of running RC Script.People willing to get the indepth knowledge in getting knowledge such as TestNG,jenkins,Maven and POM should get properly get best selenium training in chennai
ReplyDeleteNice information about the installation of selenium RC scripts the steps pf installation are explained in easy and understandable manner My sincere thanks for sharing this post
ReplyDeleteSelenium Training in Chennai
These ways are very simple and very much useful, as a beginner level these helped me a lot thanks fore sharing these kinds of useful and knowledgeable information.
ReplyDeletePSD to Wordpress
wordpress website development
When I initially commented, I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several emails with the same comment.
ReplyDeleteindustrial safety course in chennai
I love what you’ve got to say. But maybe you could a little more in the way of content so people could connect with it better.
ReplyDeleteindustrial course in chennai
This blog enabled me to achieve my learning objectives on this topic. Thanks for the efforts taken in sharing the thoughts with us.
ReplyDeleteSpoken English Classes in Chennai
Spoken English Class in Chennai
Spoken English in Chennai
Spoken English Class in Bangalore
English Speaking Classes in Bangalore
Spoken English in Bangalore
Excellent and useful blog admin, I would like to read more about this topic.
ReplyDeletePython Training in Chennai
Python Training Institute in Chennai
ccna Training in Chennai
Data Science Course in Chennai
Machine Learning Course in Chennai
Azure Training in Chennai
R Programming Training in Chennai
The article "Running your first Selenium RC script" is more informative. This is more helpful for our selenium training in chennai. Thanks for sharing
ReplyDeleteI have been searching for a useful post like this on salesforce course details, it is highly helpful for me and I have a great experience with this Salesforce Training who are providing certification and job assistance. Salesforce job oriented training in Noida
ReplyDeletethanks this is good blog.
ReplyDeleteCyber Security Training Course in Chennai | Certification | Cyber Security Online Training Course | Ethical Hacking Training Course in Chennai | Certification | Ethical Hacking Online Training Course |
CCNA Training Course in Chennai | Certification | CCNA Online Training Course | RPA Robotic Process Automation Training Course in Chennai | Certification | RPA Training Course Chennai | SEO Training in Chennai | Certification | SEO Online Training Course
Nice blog! Thanks for sharing this valuable information
ReplyDeleteGerman Language Course in Delhi
German Language Classes in Pune
Mindblowing blog very useful thanks
ReplyDeleteSpoken English Classes in OMR
Spoken English Classes in Chennai
Such a good post .thanks for sharing
ReplyDeleteSalesforce Training in T Nagar
Salesforce Training in Chennai
This post is so interactive and informative.keep update more information…
ReplyDeleteSpoken English Classes in Anna Nagar
Spoken English Classes in Chennai
Great post. keep sharing such a worthy information.
ReplyDeleteSEO Training in Chennai
SEO Course
mmorpg oyunlar
ReplyDeleteINSTAGRAM TAKİPÇİ SATİN AL
tiktok jeton hilesi
tiktok jeton hilesi
antalya saç ekimi
TAKİPCİ
İnstagram takipçi satın al
MT2 PVP SERVERLER
takipçi satın al
TÜL PERDE MODELLERİ
ReplyDeleteNumara onay
mobil ödeme bozdurma
nft nasıl alınır
ankara evden eve nakliyat
trafik sigortası
dedektör
web sitesi kurma
aşk kitapları
SMM PANEL
ReplyDeletesmm panel
İS İLANLARİ
İnstagram Takipçi Satın Al
Hirdavatci burada
beyazesyateknikservisi.com.tr
SERVİS
Tiktok jeton hilesi indir