Open GoogleCodeExporter opened 9 years ago
Issue 6227 has been merged into this issue.
Original comment by a.u.savchuk
on 7 Sep 2013 at 5:17
Hi!
Please provide executable test script
and public URL or HTML+CSS+JS of page at which the problem is reproduced.
Original comment by a.u.savchuk
on 7 Sep 2013 at 5:20
Original comment by a.u.savchuk
on 7 Sep 2013 at 5:20
ok
Original comment by chester....@gmail.com
on 8 Sep 2013 at 4:10
Hi avchuk,
Here is the runnable script and public url within, may be will help you a
little!
import unittest
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
TEST_ACCOUNTS = [('cuat2','111111','uat')]
TIME_OUT_FOR_GET_ELEMENT = 20
class Global:
SESSION = {"current_domain_name":''}
class Environment:
SCHOOL_UAT = 'schooluat.englishtown.com'
class TestDragDropByOffSet(unittest.TestCase):
def setUp(self):
self.main_url = "http://%s/online/member/login2?lng=en"
self.activity_url = "http://schooluat.englishtown.com/school/e12?debug=p=2sca&ctr=fr&lng=en#school/78107/396/570/2179/9200/41108/123032"
self.web_driver = WebDriver()
def tearDown(self):
self.web_driver.quit()
pass
def get_element(self, xpath, timeout=TIME_OUT_FOR_GET_ELEMENT):
find_element_expression = lambda x:x.find_element_by_xpath(xpath)
element = WebDriverWait(self.web_driver, timeout).until(find_element_expression)
return element
def test(self):
self.web_driver.get(self.main_url%Global.Environment.SCHOOL_UAT)
LOGIN_USER_NAME = self.get_element("//input[@id='UserName']")
LOGIN_PASSWORD = self.get_element("//input[@id='Password']")
LOGIN_SUBMIT_BUTTON = self.get_element("//a[contains(@class,'et-btn-submit')]")
LOGIN_USER_NAME.send_keys('cuat2')
LOGIN_PASSWORD.send_keys('111111')
LOGIN_SUBMIT_BUTTON.click()
self.web_driver.get(self.activity_url)
answer = self.get_element("//ul[@class='ets-act-swv-list ui-sortable']/li[@id='%s']"%'w_4')
question = self.get_element("//ul[@class='ets-act-swv-list ui-sortable']/li[@data-position='%s']"%5)
action_chains = ActionChains(self.web_driver)
action_chains.drag_and_drop_by_offset(answer, question.location['x'], question.location['y']).perform()
assert 0
pass
def suite():
suite = unittest.TestSuite()
for i in range(1):
suite.addTest(TestDragDropByOffSet('test'))
return suite
if __name__ == '__main__':
unittest.main(defaultTest='suite')
Original comment by chester....@gmail.com
on 8 Sep 2013 at 5:38
Hi!
I can not reproduce it for my Win7, selenium 2.35, chromedriver 2.3, chrome 29.
Could you recheck it with the latest chromedriver?
Also please provide exception for example from #c5
Original comment by a.u.savchuk
on 9 Sep 2013 at 10:52
Hi, but it's still not working on my side ( Win7, selenium 2.35, chromedriver
2.3, chrome 29)
The exception:
E
======================================================================
ERROR: test (__main__.TestDragDropByOffSet)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\eclipse\workspace2\SchoolAutomation\src\common\test.py", line 51, in test
action_chains.drag_and_drop_by_offset(answer, question.location['x'], question.location['y']).perform()
File "C:\Python27\lib\site-packages\selenium-2.35.0-py2.7.egg\selenium\webdriver\common\action_chains.py", line 44, in perform
action()
File "C:\Python27\lib\site-packages\selenium-2.35.0-py2.7.egg\selenium\webdriver\common\action_chains.py", line 192, in <lambda>
'yoffset': yoffset}))
File "C:\Python27\lib\site-packages\selenium-2.35.0-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 165, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium-2.35.0-py2.7.egg\selenium\webdriver\remote\errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'unknown error: at least an element or offset
should be set\n (Session info: chrome=29.0.1547.66)\n (Driver info:
chromedriver=2.3,platform=Windows NT 6.1 SP1 x86_64)'
----------------------------------------------------------------------
Ran 1 test in 23.016s
FAILED (errors=1)
Original comment by chester....@gmail.com
on 9 Sep 2013 at 12:06
Hi!
The error "at least an element or offset should be set" is raised when
chromedriver receives no "xoffset" or "yoffset" JSON parameter.
Could you check what question.location contains before executing of line:
action_chains.drag_and_drop_by_offset(answer, question.location['x'],
question.location['y']).perform()
?
Also it'd be good if you investigate what JSON string python binding sends to
chromedriver.
Original comment by a.u.savchuk
on 10 Sep 2013 at 12:28
hi about what contains in question.location from #c5:
print answer
print question
print question.location['x']
print question.location['y']
print type(question.location['x'])
print type(question.location['y'])
outputs:
<selenium.webdriver.remote.webelement.WebElement object at 0x02AAAEF0>
<selenium.webdriver.remote.webelement.WebElement object at 0x02AAAFB0>
327.5
430
<type 'float'>
<type 'int'>
Original comment by chester....@gmail.com
on 11 Sep 2013 at 1:54
The json string:
request1:
http://127.0.0.1:21172/session/36af2540235e84cd68752fdf51e45858/element/0.255741
33172631264-2/location
json1:
JSON
sessionId=36af2540235e84cd68752fdf51e45858
status=0
value
toString
x=327.5
y=482
================================================================================
=====================
request2:
http://127.0.0.1:21172/session/36af2540235e84cd68752fdf51e45858/moveto
json2:
JSON
sessionId=36af2540235e84cd68752fdf51e45858
status=0
value=(null)
================================================================================
======================
request3:
http://127.0.0.1:21172/session/36af2540235e84cd68752fdf51e45858/buttondown
json3:
JSON
sessionId=36af2540235e84cd68752fdf51e45858
status=0
value=(null)
================================================================================
======================
request4:
http://127.0.0.1:21172/session/36af2540235e84cd68752fdf51e45858/moveto
json4:
JSON
sessionId=36af2540235e84cd68752fdf51e45858
status=13
message=unknown error: at least an element or offset should be set
(Session info: chrome=29.0.1547.66)
(Driver info: chromedriver=2.3,platform=Windows NT 6.1 SP1 x86_64)
Original comment by chester....@gmail.com
on 11 Sep 2013 at 2:13
Reproduced.
The problem is with float coordinate - chromedriver accepts only integers now.
Force converting was enabled in Python and Ruby bindings at rfc395f18551d
Original comment by a.u.savchuk
on 12 Sep 2013 at 12:04
You could make force converting manually by:
question.location['x'] = int(question.location['x'])
as workaround.
Original comment by a.u.savchuk
on 12 Sep 2013 at 12:05
hi, savchuk
That's great for me, thanks a lot !
Original comment by chester....@gmail.com
on 12 Sep 2013 at 12:37
Original comment by kkania@chromium.org
on 30 Sep 2013 at 10:52
Original comment by samu...@chromium.org
on 21 Feb 2015 at 12:19
Original issue reported on code.google.com by
chester....@gmail.com
on 7 Sep 2013 at 5:19