0

I am trying to test with selenium the rating of Tripadvisor:

enter image description here

The problem is that there is not a element to click, but it depends on where is the mouse. I found a solution to this problem but is written on java, solved by @DebanjanB : How to handle the ratings within bubble rating widget with in Tripadvisor?

I beg your perdon since the question is already asked but I have no clue of how to turn that java code into python.

Kodos23
  • 65
  • 8
  • 1
    if you combine that link above (written in Java) with this one you should be able to figure it out: https://www.geeksforgeeks.org/action-chains-in-selenium-python/ – JD2775 Apr 24 '21 at 16:17
  • Kind of, I ended up with this line of code: ActionChains(driver).move_to_element(WebDriverWait(driver, 10).until(EC.visibility_of_element_located(By.XPATH, (".//*[@id='bubble_rating']"))), 50).click().build().perform() But now i recive the error that __init__() takes 2 positional arguments but 3 were given, I can´t understand the root of this problem, what is the 3º position??, I have already deleted, moved and changed all of that line and still the same result – Kodos23 Apr 26 '21 at 08:58
  • That error looks to be referencing another piece of code entirely from the one you pasted in your comment – JD2775 Apr 26 '21 at 14:35

1 Answers1

0

I finally found the way to code that with python.

Actions(driver).moveToElement(new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@id='bubble_rating']"))), 50, 0).click().build().perform()
  1. Delete all that can cause syntax problems, like "new"
  2. Delete .build()
  3. Forget the part of the ,50,0,, EC.byXPATH and make the code to wait until it research the Class that you want
Kodos23
  • 65
  • 8