Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 36
Location : Germany

[solved]example tests Empty [solved]example tests

Mon Feb 06, 2012 11:02 pm
hey guys I want to start making my tests witch webdriver/eclipse and java. And I am now learning the commands.... I'm still in the beggining and I got something like this :

public class drafts {

public static void main(String[] args){
WebDriver driver = new FirefoxDriver();
driver.get("https://website/login.php");
driver.findElement(By.xpath("//*[@id='content-container']/div[1]/form/div[2]/div[1]/input")).sendKeys("admin");
driver.findElement(By.xpath("//*[@id='content-container']/div[1]/form/div[2]/div[2]/input")).sendKeys("password");
driver.findElement(By.xpath("//*[@id='content-container']/div[1]/form/div[2]/input")).click();
...........................................................
....................................
.......................................


but It's a bit hard because I don't know the basic commands. Yes I can find them in the documentation on the selenium website but Its a bit messy and hard to find the commands you need.
So I was wondering if someone can send me a few example tests so I can see the most used commands in action so I will be able to understand them easier and faster. For example If I change the above code to InternetExplorerDriver isntead of FirefoxDriver the sendKeys command seems to not work and I have no idea why. I hope someone can send me an example of a test implemented for the different browsers (firefox/IE/chrome/opera/ and Im not sure if there is support for safari in webdriver ?). Thanks. You can add the tests here or send them to my email : zlos7ar@gmail.com . Thanks again and I wish you all a great week !


Last edited by zlos7ar on Wed Feb 08, 2012 3:32 pm; edited 1 time in total
avatar
qappbc
Amateur
Amateur
Posts : 38
Join date : 2011-10-13

[solved]example tests Empty Re: [solved]example tests

Tue Feb 07, 2012 4:45 am
Treat this question like a defect report:

1. post ALL of your test code here (like the import lines at top)
2. What error(s) generated when run?
3. what url is it you are trying to access when IE cannot do?
a. What version #s of browsers are you driving?

Note: http://sqa.stackexchange.com/questions/1181/selenium-form-input-sendkeys-doesnt-always-work-under-ie

There is a huge amount of Selenium/WebDriver/Java in eclipse test examples available on the Internet just by doing a Google search.
avatar
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 36
Location : Germany

[solved]example tests Empty Re: [solved]example tests

Tue Feb 07, 2012 5:07 pm
I fixed the problem with IE its ok now.
But funny why I can not find a good examples.....
For example when I export my selenium IDE tests as "JUnit 4 (WebDriver)" I get these some errors:
1. // ERROR: Caught exception [ERROR: Unsupported command [fireEvent]]
2. // ERROR: Caught exception [ERROR: Unsupported command [isTextPresent]]
3. // ERROR: Caught exception [ERROR: Unsupported command [getEval]]

In IDE they look like this:
1. fireEvent name=input_4 blur
2. assertTextPresent sometext
3. store javascript{var bool=(storedVars['lastidea']===storedVars['topidea']);bool;} bool


How can I change those to work ? There is nothing about this in google (at least I can't find it).
avatar
qappbc
Amateur
Amateur
Posts : 38
Join date : 2011-10-13

[solved]example tests Empty Re: [solved]example tests

Wed Feb 08, 2012 12:58 am
Glad you fixed the issue with IE. What was the problem and how fixed?

FYI: you should start a new post for this new problem...
Look here:

http://stackoverflow.com/questions/8120315/how-to-test-richfaces-combobox-with-selenium-webdriver

and here: (Export anomolies & conditions)
http://srackham.wordpress.com/2011/10/25/testing-coffeescript-apps-with-selenium/

The problem is the current lack of 1-to-1 mapping when you export from IDE. WebDriver becomes the domain for a programmer, where you have to look at the available choice(s) to see what will work for your specific problem. Sometimes that means, perhaps in your case in this last issue, to point to a class called 'Actions' and make use of it.

If you want specific help and can do so, give the url & your code and restate the issue in a new thread.
avatar
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 36
Location : Germany

[solved]example tests Empty Re: [solved]example tests

Wed Feb 08, 2012 3:32 pm
There was no issue with IE, because when I tried it on the next day it just worked. I guess I was doing something wrong the previous day but I'm not sure what Smile Thanks for the links if I can't fix it I will start a new post.
avatar
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 36
Location : Germany

[solved]example tests Empty Re: [solved]example tests

Wed Feb 08, 2012 4:03 pm
It appears that not all IDE commands are supported in "JUnit 4 (WebDriver)" so I decided to use "JUnit 4 (WebDriver Backed)" and now it works perfectly cheers and even the code is a lot easier to understand.
Sponsored content

[solved]example tests Empty Re: [solved]example tests

Back to top
Permissions in this forum:
You cannot reply to topics in this forum