I'm having trouble clicking a button when scraping with laravel lumen Goutter

Viewed 98

I am using laravel / lumen. I need to scrape a page, I am using the Goutte package. This is the HTML. This is the HTML of the page.

<div id="locationMessage">
   <div>
      <h4>
         In order
      </h4>
   </div>
   <div>
      <button id="locationChinaNorth" type="button" class="btn">China (Chinese Mainland) - North</button>
   </div>
   <div>
      <button id="locationChinaSouth" type="button" class="btn">China (Chinese Mainland) - South<br />Hong Kong SAR (China) / Taiwan (China)</button>
   </div>
   <div>
      <button id="locationOther" type="button" class="btn">All other locations</button>
   </div>
   <div class="margin0">
      <a href="https://apps.apple.com/us/app/mymsc/id1454791941?ls=1"><img src="/myMSC/Content/Images/download-mymsc-on-app-store.svg" alt="DOWNLOAD MYMSC ON APP STORE" /></a>
      <a href="https://play.google.com/store/apps/details?id=com.MSC.myMSCApp"><img src="/myMSC/Content/Images/download-on-google-play.png" alt="DOWNLOAD MYMSC ON GOOGLE PLAY" id="imgStoreGoogle" /></a>
   </div>
</div>

I just need to click the button with id = "locationOther", but I get errors using "link" and "selectButton" with no good results.

I hope someone can help me, thank you!

1 Answers

$buttonCrawler = $crawler->selectButton('Button text');

Related