Below is my script which check is element present. When I give this selector:
css=input[name='flightSearchParam[3].originAirport']
in Selenium Ide it find me this element, but when I run this in selenium rc it can't find it. I think that it is a problem with brackets.
What I must to change to find this element by selenium rc?
I run it at Windows XP and Polish Culture
Script is ready to run.
# -*- coding: utf-8 -*-
from selenium import selenium
import unittest, time, re
class Untitled(unittest.TestCase):
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", 5555, "*chrome", "http://www.aa.com/")
self.selenium.start()
def test_untitled(self):
sel = self.selenium
sel.open("/international/internationalSplashAccess.do?countryCodeForIP=PL")
sel.click("localeSubmit")
sel.wait_for_page_to_load("30000")
for i in range(60):
try:
if sel.is_element_present("aa-hp-multi-city-link2"): break
except: pass
time.sleep(1)
else: self.fail("time out")
sel.click("aa-hp-multi-city-link2")
sel.click("flightSearchForm.button.reSubmit")
sel.wait_for_page_to_load("30000")
for i in range(60):
try:
if sel.is_element_present(u"css=input[name='flightSearchParam[3].originAirport']"): break
except: pass
time.sleep(1)
else: self.fail("time out")
def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
Body for :
conn.request("POST", "/selenium-server/driver/", body, headers)
u'cmd=isElementPresent&1=css%3Dinput%5Bname%3DflightSearchParam%5B2%5D.originAirport%5D&sessionId=02b3341a3fee46f5a1e6d9c13d6e8916'
EDIT
I change it to sel.is_element_present("dom=document.getElementsByName('flightSearchParam[3].originAirport')[0]"):
and it find this element. But, I still don't know why css doesn't work here :/