title: Selenium Click JS Button - Python?
body: <p>yeah, there are similar question, but upon reading through them I weren't able to find a solution for my problem.</p>
  
  <p>Following situation: I'm tryin to click the "reply" button on "<a href="https://charleston.craigslist.org/ctd/d/charleston-2018-nissan-sentra-sedan-4d/7108660907.html" rel="nofollow noreferrer">https://charleston.craigslist.org/ctd/d/charleston-2018-nissan-sentra-sedan-4d/7108660907.html</a>" and after executing this click a popups shows up where I shall click another button, but let's start with the first button as the "reply" click itself is very trouble-making.</p>
  
  <p>The reply button has the following X-Path:</p>
  
  <pre><code>'/html/body/section/section/header/div[2]/div/button'
  </code></pre>
  
  <p>speaking of which the source code is:</p>
  
  <pre><code>&lt;button role="button" class="reply-button js-only" data-href="/__SERVICE_ID__/chs/ctd/7108660907"&gt;
        reply
      &lt;/button&gt; 
  </code></pre>
  
  <p>(see code on mentioned website).</p>
  
  <p>However, my approach with Selenium (Python) doesn't work:</p>
  
  <pre><code>reply_button = '/html/body/section/section/header/div[2]/div/button'
  driver.get('https://charleston.craigslist.org/ctd/d/charleston-2018-nissan-sentra-sedan-4d/7108660907.html')
  
  driver.find_element_by_xpath(reply_button).click()
  </code></pre>
  
  <p>Everytime I tried, the website just loads up properly (even with implementing time.sleep(x)) and tries to click the button, but this fails and the website just refreshes - my guess is that they either regocnize the browser being Selenium-controlled, that the click isn't legitimate or that I didn't catch anything right in my code.. Anyone able to help out?</p>
  
  <p>Btw I already tried searching "by_class_name", that didn't work either.</p>