Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx

» Selenium IDE Verify different Maps (Hybridview, Mapview etc.)
Fri Nov 25, 2016 9:56 pm by DJ87

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Problem with waitForPageToLoad()

View previous topic View next topic Go down

Problem with waitForPageToLoad()

Post by susmitha on Tue Oct 25, 2011 5:14 pm

Hi All,

step 1): selenium.click("id=signIn");
step 2): selenium.waitForPageToLoad("30000");
step 3): selenium.click("id=signOut");

Sometimes i am getting exception while executing step 3).
So i increased the waitForPageToLoad from 30 sec to 100sec, even though i am
getting exception element id=signOut not found.

how to use selenium.clickAndWait() in selenium rc ?

susmitha
Active particpant
Active particpant

Posts : 15
Join date : 2011-10-21

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by faramka on Wed Oct 26, 2011 1:57 pm

Did you try
Code:
selenium.clickAndWait("id=signIn");
then
Code:
selenium.clickAndWait("id=signOut");
?

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by susmitha on Thu Oct 27, 2011 12:36 pm

I tried
Code:
selenium.clickAndWait("id=signIn");

but showing error

susmitha
Active particpant
Active particpant

Posts : 15
Join date : 2011-10-21

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by faramka on Thu Oct 27, 2011 1:20 pm

What error exactly?

Maybe this topic will help http://www.qualitytesting.info/forum/topics/does-selenium-rc-support?xg_source=activity

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by freesky on Thu Oct 27, 2011 4:40 pm

what's the environment? what're the steps? what's the error? Pls more detail so that other people can help you more quickly.

freesky
Amateur
Amateur

Posts : 72
Join date : 2011-04-13

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by susmitha on Thu Oct 27, 2011 5:01 pm

I am using Selenium RC with java as client driver.

I mean showing error means that there is no much method Selenium RC 1.0 api.

Actually i am testing gmail sign in & sign out functionality.
Upto sign in it is working fine, after that i am clicking on sent mail and then sign out.

Sometimes this process is working fine and other times it's not working.So i thought before page loading only, selenium server is checking for the element "Sent mail".

I tried with
Code:
waitForCondition((selenium.isElementPresent("link=Sent Mail") == true?"true":"false"),"8000");

But it is throwing selenium exception : Time out after 8000 ms

this method
Code:
selenium.isElementPresent("link=Sent Mail") == true?"true":"false";
is returning false only.

susmitha
Active particpant
Active particpant

Posts : 15
Join date : 2011-10-21

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by freesky on Fri Oct 28, 2011 8:44 am

clickAndWait() is a command of IDE, but not exist in RC.
in RC, the clickAndWait is broke down 'click' and 'watiForPageToLoad("3000").
And in RC, the code should be :
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("//div[@id="1"]")) break; } catch (Exception e) {}
Thread.sleep(1000);
}

not only selenium.isElementPresent("//div[@id="1"]").

If it's still existing the error, you can try to make the 'second' more longer.

freesky
Amateur
Amateur

Posts : 72
Join date : 2011-04-13

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by faramka on Fri Oct 28, 2011 3:09 pm

freesky wrote:clickAndWait() is a command of IDE, but not exist in RC.

You are not right. There is clickAndWait() command in Selenium RC. I'm using Selenium RC with PHPUnit.

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by susmitha on Mon Oct 31, 2011 12:05 pm

Thanks for all of your suggestions.
Now it's working.
I increased the timeout value for waitForCondition() from 8000ms to 30000 ms.
And also i used
Code:
selenium.setSpeed(5000);
for delaying execution of selenium commands one after the other.

But now another problem arises

While clicking for inbox, i used
Code:
selenium.click("link=Inbox ");
but when there is an unread mail in inbox or any new mail comes to inbox, link is changing, then i need to change the above method as
Code:
selenium.click("link=Inbox (1)");

According to Selenium doc, it is better to use "href" when link is dynamically changing. so i record the inbox clicking as
Code:
selenium.click("//a[contains(@href, 'https://mail.google.com/mail/?shva=1#inbox')]");
I recorded this element locator by Selenium IDe only, but it is
elemnet not found Exception

susmitha
Active particpant
Active particpant

Posts : 15
Join date : 2011-10-21

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by faramka on Mon Oct 31, 2011 2:12 pm

You should try:
Code:
selenium.click("//a[contains(text(), 'Inbox')]");
I think it will work fine.

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by susmitha on Mon Oct 31, 2011 4:43 pm

faramka wrote:
Code:
selenium.click("//a[contains(text(), 'Inbox')]");
When a new mail or unread mails in Inbox then the below method changes from
Code:
selenium.click("//a[contains(text(), 'Inbox')]"); 
to
Code:
selenium.click("//a[contains(text(), 'Inbox(1)')]"); 

So i need to modify my script every time, whenever i wants to run this.

How to uniquely identify the inbox( dynamically changing element)?

susmitha
Active particpant
Active particpant

Posts : 15
Join date : 2011-10-21

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by faramka on Mon Oct 31, 2011 4:53 pm

Is the second parameter of contains() variable or just a string ('Inbox')?

When you use
Code:
selenium.click("//a[contains(text(), 'Inbox')]");
click method will work properly with every link containing 'Inbox' like 'Inbox (1)' or 'Inbox (5)', or even any other text, for example, 'My Inbox' or 'ThisInboxHasOneUnreadMail' Wink


Hmmm, one main question: do you want to open inbox just when there is a new mail or always (regardless of whether there is something new)?

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by susmitha on Mon Oct 31, 2011 8:14 pm

faramka wrote:
Hmmm, one main question: do you want to open inbox just when there is a new mail or always (regardless of whether there is something new)?

I want to click on Inbox always whether a new mail comes or not.

But when i am trying to record clicking on a particular mail through selenium ide, it's not recording.

How to achieve mail clicking in gmail?

susmitha
Active particpant
Active particpant

Posts : 15
Join date : 2011-10-21

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by faramka on Mon Oct 31, 2011 9:12 pm

So what do you want to do now? Open Inbox or open & get one particular email?

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by susmitha on Tue Nov 01, 2011 11:51 am

open Inbox and then click & open one particular email from displayed mails list?

susmitha
Active particpant
Active particpant

Posts : 15
Join date : 2011-10-21

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by faramka on Wed Nov 02, 2011 2:41 pm

Now you know how to open Inbox. You can check length of this link's text
Code:
a[contains(text(), 'Inbox')]
and verify if there is a new mail in the Inbox. Then, I think, you should try with XPath to open one particular message - find the table containing mails and then try to click at the first element tr in this table (the newest mails are on the top, so at the start of table).

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by susmitha on Wed Nov 02, 2011 4:08 pm

Hi Faramka,
Thank you very much for the reply.

I tried like this:

Code:

      selenium.isElementPresent("//table[@id='pd']//tr[1]/td[3]")  // returns false;
      selenium.isElementPresent("//table[@id='pd']")            // returns false;

I noticed one issue that Gmail is in sometimes iframes and other times as tables.

If it is in tables then Selenium IDE is recording clicking on a particular mail.
If it is in iframes then it IDE is not recording clicking on a particular mail.

What should i do if i want to open a particular mail even though any number of new mails arrives into Inbox?

Pls correct me if i had done anything wrong.

Regards,
Susmitha

susmitha
Active particpant
Active particpant

Posts : 15
Join date : 2011-10-21

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by faramka on Wed Nov 02, 2011 5:31 pm

susmitha wrote:I noticed one issue that Gmail is in sometimes iframes and other times as tables.
Do you know (or can you define) what does it depend? Does it depend on the web browser? I have checked it in Chrome and then in Firefox - in both cases I see mails in the table.

Could you show some code with iframes?

You can check the page (Inbox page) and determine if there is the table with mails and do specific operations depending on type of gmail (iframes or tables).

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by susmitha on Wed Nov 02, 2011 8:25 pm

Mails are in table only.
But the code
Code:
<iframe id="canvas_frame" class="cO" frameborder="0" title="main" src="?ui=2&view=bsp&ver=ohhl4rw8mbn4" name="ce7n1unwur0c">
followed by html code , is not recording clicking on a mail using selenium Ide

But i resolved clicking on one of the dispalyed inbox mails using these methods

Code:
selenium.isElementPresent("//html/body/div/div[2]/div/div[2]/div/div[2]/div/div/div/div[2]/div/div/div/div/div[2]/div/div/div[7]/div/div/table/tbody/tr[4]/td[3]/div/span/span"));
// xpath copied using firebug to know whether this element exists or not

Code:
selenium.clickAt("//html/body/div/div[2]/div/div[2]/div/div[2]/div/div/div/div[2]/div/div/div/div/div[2]/div/div/div[7]/div/div/table/tbody/tr[4]/td[3]/div/span/span", "");
// for clicking on that particular element


Last edited by susmitha on Thu Nov 03, 2011 11:36 am; edited 2 times in total (Reason for editing : ccode is not visible)

susmitha
Active particpant
Active particpant

Posts : 15
Join date : 2011-10-21

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by susmitha on Wed Nov 02, 2011 8:37 pm

Mails are in table only.
But the code
Code:
<iframe id="canvas_frame" class="cO" frameborder="0" title="main" src="?ui=2&view=bsp&ver=ohhl4rw8mbn4" name="ce7n1unwur0c">
followed by html code , is not recording clicking on a mail using selenium Ide

But i resolved clicking on one of the dispalyed inbox mails using these methods
Code:
selenium.isElementPresent("//html/body/div/div[2]/div/div[2]/div/div[2]/div/div/div/div[2]/div/div/div/div/div[2]/div/div/div[7]/div/div/table/tbody/tr[4]/td[3]/div/span/span"));
// xpath copied using firebug to know whether this element exists or not

Code:
selenium.clickAt("//html/body/div/div[2]/div/div[2]/div/div[2]/div/div/div/div[2]/div/div/div/div/div[2]/div/div/div[7]/div/div/table/tbody/tr[4]/td[3]/div/span/span", "");
// for clicking on that particular element

susmitha
Active particpant
Active particpant

Posts : 15
Join date : 2011-10-21

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by faramka on Thu Nov 03, 2011 7:35 pm

OK Smile
I think, you don't need to use clickAt method, 'cause you don't use coordinates and the second parameter of this method stays empty. Just try with click method.

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by susmitha on Fri Nov 04, 2011 12:32 pm

faramka wrote:OK Smile
I think, you don't need to use clickAt method, 'cause you don't use coordinates and the second parameter of this method stays empty. Just try with click method.

Thank you very much.

But clickAt() with empty coordinates is working for me.

susmitha
Active particpant
Active particpant

Posts : 15
Join date : 2011-10-21

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by venkatkoritala on Thu Dec 13, 2012 4:23 pm

susmitha wrote:I tried
Code:
selenium.clickAndWait("id=signIn");

but showing error


there is no clickAndWait() method in selenium rc

venkatkoritala

Posts : 6
Join date : 2012-11-22

Back to top Go down

Re: Problem with waitForPageToLoad()

Post by Sponsored content Today at 1:15 am


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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