Can you share link to production site? So we can look more closely what kind of alert do you have?
And as I mentioned, when I use standard driver tests pass.
On Tue, May 16, 2017, 3:11 AM byakatat ***@***.***> wrote:
@yashaka <
https://github.com/yashaka>
Sure. Use Chrome browser.
1. Login here login page <
https://m.florist.ru/users/login/>
with email: ***@***.*** and password: 123456
2. Click on the logo on the left top corner - a main page will be
opened
3. Click on any bouquet - a bouquet page will be opened
4. Click "Оформить заказ" button - a cart page will be opened
5. Click "Оформить заказ" button again - a delivery date page will be
opened
6. Click "Следующий шаг" button - a recipient page will be opened
7. And here you should choose recipient from dropdown, look here
https://yadi.sk/i/pAdyELYD3JC9Sm
and allert will appear.
And as I mentioned, when I use standard driver tests pass.
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<
#128 (comment)>, or mute
the thread
<
https://github.com/notifications/unsubscribe-auth/AB3snhCFkGuN6qKx-Aj0wuHuQW5ERQBUks5r6T4MgaJpZM4NJ0f5>
Check
I have checked the situation in actual 2.0.34a selene core api version. And there is no problem.
I resurrected alert tests for 2.0.34a core api: 8b53e71 and ensured that they work fine.
import os
import pytest
from selenium import webdriver
from selenium.common.exceptions import NoAlertPresentException
from webdriver_manager.chrome import ChromeDriverManager
from selene import Config, Browser
start_page = 'file://' + os.path.abspath(os.path.dirname(__file__)) + '/../resources/start_page.html'
@pytest.fixture(scope='session')
def session_driver():
chrome_driver = webdriver.Chrome(ChromeDriverManager().install())
yield chrome_driver
chrome_driver.quit()
@pytest.fixture(scope='function')
def session_browser(session_driver):
yield Browser(Config(driver=session_driver))
def test_can_accept_alert(session_browser):
session_browser.open(start_page)
session_browser.element("#alert_btn").click()
session_browser.driver.switch_to.alert.accept()
try:
session_browser.driver.switch_to.alert
assert False, 'actual: alert presents, expected: alert not present'
except NoAlertPresentException:
assert True
def test_can_dismiss_confirm_dialog(session_browser):
session_browser.open(start_page)
session_browser.element("#alert_btn").click()
session_browser.driver.switch_to.alert.dismiss()
try:
session_browser.driver.switch_to.alert
assert False, 'actual: alert presents, expected: alert not present'
except NoAlertPresentException:
assert True
def test_alert_is_present(session_browser):
session_browser.open(start_page)
session_browser.element("#alert_btn").click()
try:
session_browser.driver.switch_to.alert
assert True
except NoAlertPresentException:
assert False, 'actual: alert not present, expected: alert is present'
Suggestion
The problem of TC could be in selene version 1.0.10a because it hadn't clear and consistent api yet. There is no code to check he used selene api properly.
I upped tests of selene version 1.0.10a too, and had the trouble with the api, cause
from selene.browser import driver, visit
visit(page)
driver().switch_to.alert.accept()
driver()
function opened new window instead of shared driver from visit()
method.
So the script of calling alert in selene 1.0.10a should look like in tests below:
import os
from time import sleep
from selenium.common.exceptions import NoAlertPresentException
from selene import factory, browser
start_page = 'file://' + os.path.abspath(os.path.dirname(__file__)) + '/../resources/start_page.html'
# todo: ensure works and enabled
def test_can_accept_alert():
browser.visit(start_page)
browser.element("#alert_btn").click()
shared_driver = factory.get_shared_driver()
shared_driver.switch_to.alert.accept()
try:
shared_driver.switch_to.alert.accept()
assert False, 'actual: alert presents, expected: alert not present'
except NoAlertPresentException:
assert True
def test_can_dismiss_confirm_dialog():
browser.visit(start_page)
browser.element("#alert_btn").click()
shared_driver = factory.get_shared_driver()
shared_driver.switch_to.alert.dismiss()
try:
shared_driver.switch_to.alert.dismiss()
assert False, 'actual: alert presents, expected: alert not present'
except NoAlertPresentException:
assert True
Resolution
Issue not reproduced. The problem could be in not proper usage of the selene - check the "Suggestion" block above.
Issue can be closed until we see the whole code with imports which TC has used to reproduce the issue.
@byakatat does this problem still actual on selene v2.0.0a34
? Can you provide more details please, because UI from your example has been changed and that's why i cannot reproduce your case. But we have selene tests which shows up it's working now and i found PR which should fix this problem.
Seems it could be this bug, the same issue at the same time #117.
This bug has been fixed in PR #118.