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
susmitha
Active particpant
Active particpant
Posts : 15
Join date : 2011-10-21

Problem with waitForPageToLoad() Empty Problem with waitForPageToLoad()

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 ?
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

Wed Oct 26, 2011 1:57 pm
Did you try
Code:
selenium.clickAndWait("id=signIn");
then
Code:
selenium.clickAndWait("id=signOut");
?
avatar
susmitha
Active particpant
Active particpant
Posts : 15
Join date : 2011-10-21

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

Thu Oct 27, 2011 12:36 pm
I tried
Code:
selenium.clickAndWait("id=signIn");

but showing error
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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
avatar
freesky
Amateur
Amateur
Posts : 72
Join date : 2011-04-13

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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.
avatar
susmitha
Active particpant
Active particpant
Posts : 15
Join date : 2011-10-21

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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.
avatar
freesky
Amateur
Amateur
Posts : 72
Join date : 2011-04-13

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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.
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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.
avatar
susmitha
Active particpant
Active particpant
Posts : 15
Join date : 2011-10-21

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

Mon Oct 31, 2011 2:12 pm
You should try:
Code:
selenium.click("//a[contains(text(), 'Inbox')]");
I think it will work fine.
avatar
susmitha
Active particpant
Active particpant
Posts : 15
Join date : 2011-10-21

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

Mon Oct 31, 2011 4:43 pm
Message reputation : 100% (1 vote)
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)?
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

Mon Oct 31, 2011 4:53 pm
Message reputation : 100% (1 vote)
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)?
avatar
susmitha
Active particpant
Active particpant
Posts : 15
Join date : 2011-10-21

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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?
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

Mon Oct 31, 2011 9:12 pm
So what do you want to do now? Open Inbox or open & get one particular email?
avatar
susmitha
Active particpant
Active particpant
Posts : 15
Join date : 2011-10-21

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

Tue Nov 01, 2011 11:51 am
open Inbox and then click & open one particular email from displayed mails list?
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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).
avatar
susmitha
Active particpant
Active particpant
Posts : 15
Join date : 2011-10-21

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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).
avatar
susmitha
Active particpant
Active particpant
Posts : 15
Join date : 2011-10-21

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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)
avatar
susmitha
Active particpant
Active particpant
Posts : 15
Join date : 2011-10-21

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

Thu Nov 03, 2011 7:35 pm
Message reputation : 100% (1 vote)
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.
avatar
susmitha
Active particpant
Active particpant
Posts : 15
Join date : 2011-10-21

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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.
avatar
venkatkoritala
Posts : 6
Join date : 2012-11-22

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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
Sponsored content

Problem with waitForPageToLoad() Empty Re: Problem with waitForPageToLoad()

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