Selenium Python click a link to javascript in an unordered list -


I am trying to click and activate the JavaScript link with Selenium. This is for a 5 star rating widget; Five-star is the exact item below Other items, IE4 stars are not fully displayed.

  & lt; Div id = "percentages_and_ratings" & gt; & Lt; Div id = "percent" & gt; & Lt; Div id = "rating" & gt; & Lt; Ul id = "personality-rating" class = "star-rating profile_rating" onmouseout = "vote.policestaraut (this)" onmouseover = "vote.tarstarver (it)" & gt; & Lt; Li id = "current-personality-3198779465475184989-1" class = "current-rating" style = "width: 0%;" & Gt; & Lt; / Li & gt; & Lt; Li & gt; ... & lt; Li & gt; ... & lt; Li & gt; ... & lt; Le & gt; ... & lt; Li & gt; & Lt; Class = "five-star" title = "" href = "javascript: processVoteNote ('vote', 'personality', 5, '2222222222222', wrong, '', '', profile.profilehidingwit); & gt; Lt; / a & gt; & lt; li class = "cant-tell" style = "display: none;" & gt; & lt; li class = "click-away" & Gt;   

Selenium unit looks like test output

  driver.find_element_by_xpath ("(// a [contains (text (), '5 ']]) [2] "). ()   

But it does not work, choosing XP, CSS, HTML with firebug does not work either. Any ideas? I have done it for a few nights, so now is the time to ask: -)

I am using Selenium Web driver and Python 2.7

Here is the information How did I finish it?

  id = self.getID (driver) script = "$ (processwise note ('vote', 'personality', 5, '' + + '', 'Incorrect', '', profile.profilehidingwit); "Driver.execute_script (script)    

Based on HTML sampling you posted, Browse R.find_element_by_class_name ('five-stars'). Click () to select successfully and click on that link if the page contains more than one element on that page's name page, then you browser.find_elements_by_class_name ('five-stars') to identify relevant links, again through that list, and then click them.

If you want to use XPATH Search, then I would recommend to use different patterns.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -