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
rappster opened this issue Dec 11, 2014 · 5 comments
Closed

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

rappster opened this issue Dec 11, 2014 · 5 comments

Comments

@rappster
Copy link

@rappster rappster commented Dec 11, 2014

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")
rappster added a commit to rappster/rvest that referenced this issue Dec 11, 2014
CSS selectors in follow_link()
@hadley
Copy link
Member

@hadley 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.

@rappster
Copy link
Author

@rappster rappster commented Dec 11, 2014

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).

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

@rappster rappster commented Dec 11, 2014

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: rappster@9e7c85c

So this is the correct one rappster@1d4f2a1

@hadley
Copy link
Member

@hadley 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?

@rappster
Copy link
Author

@rappster rappster commented Dec 15, 2014

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.

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