Прогон test case целиком и пошагово
#1
Отправлено 02 апреля 2009 - 13:21
Показать хоть что-то некому, спросить не у кого
Уткнулась в проблему, не знаю уже что бы еще придумать.
Пытаюсь банально залогиниться на сайт. Логиниться в отдельном попапе.
Пробовала открывать его и кликом и openWindow. Окно открывается, но такое ощущение, что селениум его не видит. Проверяла наличие текста из окна. Пишет, что его нет. Это все если прогонять test case целиком.
Если иду и выполняю каждую команду отдельно по порядку, то все выполняется, текст есть и кнопка нажимается.
Что я делаю не так? :(
Грубо текст выглядит так:
selenium.openWindow("http://тут живет урл", "_blank");
Thread.sleep(5000); // ну в самом деле наверное можно openWindowAndWait, но пока не работает то, что надо функционально :(
verifyTrue(selenium.isTextPresent("password"));
selenium.click("//button[@type='submit']");
Возможно если разобраться с этим, то попап и кликом можно будет открывать? Типа
selenium.click("link=Login");
selenium.waitForPopUp("_blank", "30000");
(так автоматом записанное предлагает)
#2
Отправлено 02 апреля 2009 - 20:52
Надо вызывать после клика waitForPopUp, а после открытия попапа надо сделать selectWindow(попап), чтобы дальше работать уже с ним.Если иду и выполняю каждую команду отдельно по порядку, то все выполняется, текст есть и кнопка нажимается.
#3
Отправлено 03 апреля 2009 - 07:38
Там аргумент windowID, как его узнать?
Автоматом записало _blank.
#4
Отправлено 03 апреля 2009 - 08:34
Window locators provide different ways of specifying the window object: by title, by internal JavaScript "name," or by JavaScript variable.
title=My Special Window: Finds the window using the text that appears in the title bar. Be careful; two windows can share the same title. If that happens, this locator will just pick one.
name=myWindow: Finds the window using its internal JavaScript "name" property. This is the second parameter "windowName" passed to the JavaScript method window.open(url, windowName, windowFeatures, replaceFlag) (which Selenium intercepts).
var=variableName: Some pop-up windows are unnamed (anonymous), but are associated with a JavaScript variable name in the current application window, e.g. "window.foo = window.open(url);". In those cases, you can open the window using "var=foo".
If no window locator prefix is provided, we'll try to guess what you mean like this:
1.) if windowID is null, (or the string "null") then it is assumed the user is referring to the original window instantiated by the browser).
2.) if the value of the "windowID" parameter is a JavaScript variable name in the current application window, then it is assumed that this variable contains the return value from a call to the JavaScript window.open() method.
3.) Otherwise, selenium looks in a hash it maintains that maps string names to window "names".
4.) If that fails, we'll try looping over all of the known windows to try to find the appropriate "title". Since "title" is not necessarily unique, this may have unexpected behavior.
If you're having trouble figuring out the name of a window that you want to manipulate, look at the Selenium log messages which identify the names of windows created via window.open (and therefore intercepted by Selenium). You will see messages like the following for each window as it is opened:
debug: window.open call intercepted; window ID (which you can use with selectWindow()) is "myNewWindow"
In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example). (This is bug SEL-339.) In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using an empty (blank) url, like this: openWindow("", "myFunnyWindow").
#5
Отправлено 03 апреля 2009 - 08:37
#6
Отправлено 03 апреля 2009 - 09:41
По title окно не ищет.
В коде про него
<a class="att b-user-name" href="java script:openWindow('/login/signin_shop.jsp?PPAGE=http://plaza-com.test.value4it.ru/products/&REFPAGE=http://plaza-com.test.value4it.ru/products/&SHOP_COMP_CODE=80508093807371189&APPL_ID=80508102441912328', 400, 200, '0', 0)">Login </a>
Нашла подобную темку
http://software-test...amp;#entry66476
Видимо сильно туплю, но пока не помогло.
Спасибо за попытки вразумить меня кстати :)
#7
Отправлено 03 апреля 2009 - 09:53
А что написано в openWindow? Кстати, не:По title окно не ищет.
В коде про него<a class="att b-user-name" href="java script:openWindow('/login/signin_shop.jsp?PPAGE=http://plaza-com.test.value4it.ru/products/&REFPAGE=http://plaza-com.test.value4it.ru/products/&SHOP_COMP_CODE=80508093807371189&APPL_ID=80508102441912328', 400, 200, '0', 0)">Login </a>
...href="java script...а:
...href="javascript...(без пробела), или это прямо так в исходнике написано? Тогда непонятно как оно вообще работать может.
#8
Отправлено 03 апреля 2009 - 11:12
Ну да ладно, пока будем мучать хотя бы ФФ2.
vitorg, еще раз огромное спасибо.
#9
Отправлено 03 апреля 2009 - 12:08
Т.е. там работает без selectWindow? Тогда это как раз баг при использовании FF2, который в данном случае помог :) Но без selectWindow контекст переключаться не должен.Пока я все делала в ФФ3. Посоветовали попробовать ФФ2 и там все ок :)
Мне всё-таки хотелось бы разобраться до конца с FF3, написал такой тест:
// Base URL is "http://plaza-com.test.value4it.ru" session().open("/"); session().click("link=Login"); session().waitForPopUp("_blank"); session().selectWindow("name=_blank"); assertTrue(session().isElementPresent("name=USERNAME")); assertTrue(session().isElementPresent("name=PASSWORD")); session().type("name=USERNAME","bla-bla-bla"); session().type("name=PASSWORD","mau-mau-mau");Всё прекрасно работает под FF3. Под FF2 не успел проверить, сервис http://plaza-com.test.value4it.ru отвалился.
#10
Отправлено 09 апреля 2009 - 13:02
#11
Отправлено 10 апреля 2009 - 08:35
#12
Отправлено 10 апреля 2009 - 08:44
Не, я имел ввиду - получилось ли в FF3? :) Т.к. у меня на твоём домене (см. выше) всё нормально отработало именно в FF3.Да, спасибо. Я пока тихо радуюсь :) В ФФ2 пытаюсь ваять. Пока все проблемы удается решить, почитав форум ;)
Количество пользователей, читающих эту тему: 0
0 пользователей, 0 гостей, 0 анонимных