0

I am not able to click on 'Mehr anzeigen'. I am using Python to perform this task.

HTML:

<div model="::expose.model.EstateDescription" class="ng-isolate-scope">
    <p ng-bind-html="::model | newline" class="ng-binding is-truncated" style="overflow-wrap: break-word;">Das in 1975 massiv gebaute Reihenendhaus ist auf drei Ebenen zu Wohnzwecken errichtet worden. 1990 wurde der Dachstuhl erneuert und gleichzeitig der Spitzboden ausgebaut. Im Kellergeschoss wurde die Möglichkeit zum Ausbau einer Einliegerwohnung mit separatem Eingang geschaffen. Im Erdgeschoss befindet sich ein großes Wohnzimmer mit angrenzender Terrasse, eine Küche, ein Flur und ein Gäste-WC. Im Obergeschoss wurde ein Bad mit Wanne und Dusche, zwei kleinere Schlafzimmer und ein Zimmer mit Balkon angeordnet. Im Spitzboden gibt es zwei Zimmer und... </p>
    <!-- ngIf: showLink -->
    <a ng-if="showLink" class="readmore show-more-link ng-binding ng-scope" ng-click="toggleRead()" ng-class="isTruncated?'':'open'">Mehr anzeigen</a> 
    <!-- end ngIf: showLink -->
</div>

I always get this error:

WebDriverException: Message: unknown error: Element <a ng-if="showLink" class="readmore show-more-link ng-binding ng-scope" ng-click="toggleRead()" ng-class="isTruncated?'':'open'" btattached="true">...</a> is not clickable at point (114, 567). Other element would receive the click: <p>...</p>

I have tried it on Mozilla and Chrome also.

Any tips would highly be appreciated.

I tried these methods:

driver.find_element_by_css_selector(".readmore").click()
driver.find_element_by_link_text('Mehr anzeigen').click()
driver.find_element_by_partial_link_text('Mehr an').click()

**Solution: ** Every time I open a certain URL with Selenium the cookie box appears which hides the position.

2 Answers2

0

First, wait for the paragraph element to disappear from the top of the link and then click on the link. Try the following code with the details of the paragraph element that is overlapping the link:

from selenium.webdriver.support import ui
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

ui.WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((By.CSS_SELECTOR, "p[class='ng-binding is-truncated']")));
driver.find_element_by_link_text('Mehr anzeigen').click();
melleck
  • 306
  • 4
  • 15
  • I tried these methods and they give me the same error. # driver.find_element_by_css_selector(".readmore").click() # driver.find_element_by_link_text('Mehr anzeigen').click() # driver.find_element_by_partial_link_text('Mehr an').click() – Muahmmad Abdul Wahab Oct 18 '18 at 09:33
  • Other element would receive the click:? does it give you the details of the other element that would receive the click in the error message? It usually means some other element is over the element webdriver is trying to click – melleck Oct 18 '18 at 09:45
  • I have updated my answer above where you wait for the paragraph (i.e. overlapping the link) to become invisible and then click the link text. – melleck Oct 18 '18 at 10:02
0

Did you try actions class?

Actions action = new Actions(driver);

WebElement element = driver.findElement(By.id("random id");

action.click(element).build().perform();