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

Using a CSS selector in follow_link() does not work #38

Closed
jankowtf opened this issue Dec 11, 2014 · 5 comments
Closed

Using a CSS selector in follow_link() does not work #38

jankowtf opened this issue Dec 11, 2014 · 5 comments

Comments

@jankowtf
Copy link

Seems like so far you only implemented cases where i is either a numerical position index or a string that is matched against the href description/text, but not the case when its a CSS selector or XPath statement:

s <- html_session("http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=ssd",
  httr::user_agent("Mozilla/5.0"))

## `i` is text that should be matched:
s %>% follow_link("Prime")

## `i` is valid selector:
try(s %>% follow_link("#result_0 .a-spacing-base+ .a-spacing-mini .a-spacing-none"))

## `i` is invalid selector:
s %>% follow_link("abcd")
jankowtf pushed a commit to jankowtf/rvest that referenced this issue Dec 11, 2014
CSS selectors in follow_link()
@hadley
Copy link
Member

hadley commented Dec 11, 2014

Hmmm, it looks like I forgot to modify this code after I changed how css/xpath selectors worked. I think follow_link() will need extra arguments to disambiguate between string match, css selector and xpath selector.

@jankowtf
Copy link
Author

If you hold on 5 minutes I have a pull request ready ;-)

On Thu, Dec 11, 2014 at 5:21 PM, Hadley Wickham notifications@github.com
wrote:

Hmmm, it looks like I forgot to modify this code after I changed how
css/xpath selectors worked. I think follow_link() will need extra
arguments to disambiguate between string match, css selector and xpath
selector.


Reply to this email directly or view it on GitHub
#38 (comment).

jankowtf pushed a commit to jankowtf/rvest that referenced this issue Dec 11, 2014
CSS selectors in follow_link()
@jankowtf
Copy link
Author

Sorry, I used a wrong branch for this commit referenced above and I can't seem to delete it even though I already removed the branch: jankowtf@9e7c85c

So this is the correct one jankowtf@1d4f2a1

@hadley
Copy link
Member

hadley commented Dec 12, 2014

Can you close the broken pull request and re-open?

Can you please explicitly disambiguate text vs selectors by using multiple arguments?

@jankowtf
Copy link
Author

The pending pull request is the correct one. It's just the first referenced commit that's misleading (as it stems from a different branch than the one that the pull request is based on).

I'll add args to disambiguate text vs. selectors, though.

@hadley hadley closed this as completed in 5bbeb7d Dec 31, 2014
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

2 participants