Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insufficient documentation of tests and usage #68

Open
theRealBitcoinClub opened this issue Dec 24, 2021 · 5 comments
Open

Insufficient documentation of tests and usage #68

theRealBitcoinClub opened this issue Dec 24, 2021 · 5 comments

Comments

@theRealBitcoinClub
Copy link

Hey bro, look, your package seems to be awesome, but I can hardly figure out how to use it.

For example you provide this code as test, but what would be that HTML element that you are matching with that command?:

var names = webScraper.getElementAttribute(
'div.thumbnail > div.caption > h4 > a.title', 'title');

It would be very easy for you, to provide an example HTML element of what exactly the command is matching, please could you invest a few minutes to help out everone else in this beautiful universe?

Thanks, enjoy the holiday on 03.01.

Actually as I am writing this, I realize that you are doing a test request within that test code, so maybe I can figure it out by checking the source and then I can provide you with a PR to make life easier for everyone, let me try to solve this issue myself, Ill get back here ASAP.

@tusharojha
Copy link
Owner

Thanks, @theRealBitcoinClub.

I would really appreciate a PR.

@theRealBitcoinClub
Copy link
Author

theRealBitcoinClub commented Dec 24, 2021

Ok so I found out that the statement above is related to the following code:

<div class="thumbnail">
  <img class="img-responsive" alt="item" src="/images/test-sites/e-commerce/items/cart2.png">
    <div class="caption">
      <h4>
        <a href="/test-sites/e-commerce/allinone/product/502" class="title" title="IdeaTab A3500-H">IdeaTab A3500-H</a>
      </h4>
    </div>
  </div>
</div>

And most probably targets this aspect: title="IdeaTab A3500-H"? Is that correct?

It is unclear because the content inside the following brackets is equivalent. While you are answering this question, what would be the command to get the content from inside the brackets?

@theRealBitcoinClub
Copy link
Author

Does the scraper still work in the same manner if the class tag holds various classes? e.g. class="DvzRrc ab_button"

@theRealBitcoinClub
Copy link
Author

theRealBitcoinClub commented Dec 24, 2021

<a jsaction="cGXGTb" href="javascript:void(0);" id="wrkpb" role="button" style="color:#e8eaed;text-decoration:none" class="DvzRrc ab_button" data-aspect-feedback-mode="1" data-attribution="lu-desktop-write-review" data-enable-add-photo="true" data-fid="0x8e803ca4b69dc375:0x4bd279fcc5aff74c" data-language-code="es-VE" data-maps-rw-api-key="AIzaSyBcv0QfUNUfBwo8pIGJ3teNCkaluSGUWus" data-pid="ChIJdcOdtqQ8gI4RTPevxfx50ks" data-session-index="0" data-edit-label-id="Editar opinión" data-ved="2ahUKEwjFsLq8o_z0AhWiQTABHRH_AsgQgCl6BAgUEAc">

How would you extraxt the data from the attribute "data-pid" ?

@solsticedhiver
Copy link

solsticedhiver commented Jan 6, 2023

A working example using a html string and not a website where you have to look for the source code of the page would be awesome!

In fact, more than one example, would be best, like 3 or 4.
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants