0

I am trying to web scrape using selenium in Python. I find all the links on the webpage using

elems = self.driver.find_elements_by_xpath("//a[@href]")

Below are the attributes of the individual links from the list above.

URL 1:

{u'href': u'/video/ca02339f-f8b3-4c34-a34c-5cb317b4618b/fda2decb-2d6c-4d48-9535-7362381688b3', u'_ngcontent-c15': u'', u'class': u'slider-item'}

URL 2:

{u'href': u'/video/ca02339f-f8b3-4c34-a34c-5cb317b4618b/cdc7f553-e176-49ff-a8a5-d7413dfef534', u'_ngcontent-c15': u'', u'class': u'slider-item'}

URL 3:

{u'href': u'/video/ca02339f-f8b3-4c34-a34c-5cb317b4618b/710a09a8-6c59-4195-9f1d-991b7807ec94', u'_ngcontent-c15': u'', u'class': u'slider-item'}

URL 4:

{u'href': u'/video/ca02339f-f8b3-4c34-a34c-5cb317b4618b/9659cf42-35b5-4e48-9a86-3cb2e97ed8bd', u'_ngcontent-c15': u'', u'class': u'slider-item'}

I would like to click one of the href link. There are no link texts associated with the links. Is there a way to click just the link without any other information. I could not find any information regarding following stand-alone links without any meta info.

3
  • How would you define click the link ? If There are no link texts associated with the links, what would you click upon then ?
    – ZdaR
    Commented Oct 21, 2017 at 6:08
  • Does self.driver.get(url) not do what you want? Commented Oct 21, 2017 at 6:09
  • Thanks Chris. It did not occur to me at all. It works.
    – Gaara
    Commented Oct 21, 2017 at 6:12

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.