A
A
Artem Andreev2019-04-28 16:43:09
Python
Artem Andreev, 2019-04-28 16:43:09

How to iterate through Selenium array of links from json?

There is a json format:

[
{"link": url},
{"link": url}
]

How to make Selenium go through each url? And I took certain data from each and wrote them into another json

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2019-04-28
@Pibodi

import json

with open('urls.json', 'r') as read_json:
    json_urls = json.load(read_json)
    for link in json_urls:
        print(link["link"])
        selenium_result = {}
        // Работа селениума
        selenium_result["some_result"] = "some_data"
        
with open('output.json', 'w') as write_json
        json.dump(selenium_result, write_json)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question