0

I need to get feedbacks from site

Feedbacks are inside <iframe> tag, so I go to iframe, and i get feedbacks, from the first page, but then i need change page using button:

enter image description here

Selenium can find it by class or xpath, but when it tries to click it returns error

selenium.common.exceptions.WebDriverException: Message: unknown error: Element <iframe scrolling="no" frameborder="0" marginwidth="0" marginheight="0" width="100%" height="1943" src="//feedback.aliexpress.com/display/productEvaluation.htm?productId=1000003578539&amp;ownerMemberId=825321852&amp;companyId=&amp;memberType=seller&amp;startValidDate=" cd_frame_id_="9dbc34cc8793cee8fbcab5180296b0d6"></iframe> is not clickable at point (1001, 582). Other element would receive the click: <span data-role="show" class="show-history">...</span>
  (Session info: chrome=56.0.2924.87)
  (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 6.1.7601 SP1 x86_64)

Here is my code:

driver = webdriver.Chrome()
driver.get(url)

close_popup = driver.find_element_by_class_name('close-layer')
close_popup.click()

tab_feedback = driver.find_element_by_xpath('//*[@id="j-product-tabbed-pane"]/ul/li[2]')
tab_feedback.click()

driver.switch_to.frame(driver.find_element_by_xpath('//iframe[starts-with(@src, "//feedback.aliexpress.com/display/productEvaluation.htm")]'))

text_feedbacks = driver.find_elements_by_class_name('buyer-feedback')

next = driver.find_element_by_class_name('ui-pagination-next ui-goto-page')
next.click()

I thought that maybe selenium too fast, I tried to wait and loop but still can't get next page of feedbacks. Also i tried to get this element using xpath:

next = driver.find_element_by_xpath( "//div[@class='ui-pagination-navi util-left']/a[@class='ui-goto-page']")

But nothing helps.

How can i get next page of feedbacks using selenium? Why other element receives click?

2 Answers 2

1

Try to use below code:

from selenium.webdriver.common.keys import Keys

driver.switch_to.frame(driver.find_element_by_xpath('//iframe[starts-with(@src, "//feedback.aliexpress.com/display/productEvaluation.htm")]'))

text_feedbacks = driver.find_elements_by_class_name('buyer-feedback')
driver.find_element_by_tag_name('body').send_keys(Keys.PAGE_DOWN)
next = driver.find_element_by_link_text("Next")
next.click()
driver.switch_to.default_content()

The problem is that span "Recently viewed" element overlaps required button and so intercepts the click... You might need just to scroll page a little (in provided code- by simulating Page Down button pressing)

Note that you should switch back from iframe after clicking "Next" button

Sign up to request clarification or add additional context in comments.

4 Comments

It finds element, but when click returns same error </iframe> is not clickable at point (1009, 590). Other element would receive the click: <span data-role="show" class="show-history">...</span>
Yeap, I got it now... Added little hack ;) Try updated.
It is working, thanks! What was the reason of problem?Why other element received click?
I've added clarification to answer. This is because of "Recently viewed" tab in right bottom corner of page which covers required button
0

You need to set delay for each tab_feedback.click() because the page has not been loaded fully.

import time
time.sleep(5)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.