Saturday 15 June 2013

Python - Selenium Web Driver error - self._driver.execute - AttributeError: 'unicode' object has no attribute 'id' -


I have received an answer here but my code does this already, which gives suggestions and still produces the same error That's why I'm hoping for another answer.

This is my code that calls actions:

  elif first_col_value == first_col_in_assign: res2, assign_string = assign_cmd (spreadsheet_name, line) print "main 8 - res2 / Cmd_string:% s% s "% (res2, assign_string) # assign_string2 = u" search_field = driver.find_element_by_name ("q") "if not res2: exit (wrong) other: action = webdriver.ActionChains (driver) Move_to_element (Assign_string) verb.form () continue  

is that the assignment appears to be made with a spreadsheet:

  in assign_com - param1 =% S Search_field in assign_cmd - param2 =% s driver.find_ele Ment_by_name in assign_cmd - param3 =% s in "q" assign_cmd - param4 =% s # main 8 - reset 2 / assign_string: true search_field = driver.find_edit_by_name ("q")  

And this is the error:

  Traceback (the most recent call final): The file "/home/susan/PycharmProjects/justPython/test1.py", line 397, & lt; Module & gt; Action.perform () file "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/action_chains.py", line 70, in execution action () file "/ usr / local / lib / Python2.7 / dist-packages / selenium / webdriver / common / action_chains.py ", in line 215, & lt; Lambda & gt; Self. _Driver. Exquisite (command.mov_to, {'element': to_eelment.id}) attribute: There is no attribute of the attribute code 'edi' in the 'Unicode' object. 1  

I tried to insert the Unicode string directly into my code, which has been commented in the above line but it generates the same error. I'm stuck and really appreciate any help you can give me a lot Thanks.

Believes that you are passing in an element, not before, no string:

move_to_element (to_element)

Transferring the mouse in the middle of an element. For example:

  Element = driver.find_element_by_id ('myid') action = webdriver.ActionChains (driver) .move_to_element (element) action. If you have an incoming spreadsheet configuration, I will reorganize it a bit, instead of having  find_element_by _ *  string, I have every element There are two things: a type of locator and a locator, eg .: 

  | Type | Price | | Xpath | // div [@ id = "test"] | | Name | Q | After that, in your tests, you can use it that receives a type of locator and value:  
  locator_type, Locator_value = get_locator_from_spreadsheet (...) element = driver.find_element (locator_type, locator_value) verb = webdriver.ActionChains (driver) .move_to_element (element) action.perform ()  

No comments:

Post a Comment