You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We could either rely on the fact that the sale price is likely to be always the one which is highlighted, or that it's always the first price. For now we'll rely on the former and we'll let `querySelector()` to simply return the first result:
61
+
We could either rely on the fact that the sale price is likely to be always the one which is highlighted, or that it's always the first price. For now we'll rely on the later and we'll let `querySelector()` to simply return the first result:
62
62
63
63
```js
64
64
price =subwoofer.querySelector('.price');
@@ -69,16 +69,30 @@ It works, but the price isn't alone in the result. Before we'd use such data, we
But for now that's okay. We're just testing the waters now, so that we have an idea about what our scraper will need to do. Once we'll get to extracting prices in Python, we'll figure out how to get numbers out of them.
72
+
But for now that's okay. We're just testing the waters now, so that we have an idea about what our scraper will need to do. Once we'll get to extracting prices in Python, we'll figure out how to get the values as numbers.
73
73
74
74
In the next lesson, we'll start with our Python project. First we'll be figuring out how to download the Sales page without browser and make it accessible in a Python program.
75
75
76
76
---
77
77
78
78
<Exercises />
79
79
80
-
:::danger Work in Progress
80
+
### Locate the top Movies wiki on Fandom
81
81
82
-
Under development.
82
+
On Fandom's [Movies page](https://www.fandom.com/topics/movies), use CSS selectors and HTML elements manipulation in the **Console** to extract the name of the top wiki. Use JavaScript's [`trim()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim) method to remove white space from around the name.
83
83
84
-
:::
84
+

85
+
86
+
<details>
87
+
<summary>Solution</summary>
88
+
89
+
1. Open the [Movies page](https://www.fandom.com/topics/movies).
90
+
1. Activate the element selection tool in your DevTools.
91
+
1. Click on the list item for the top Fandom wiki in the category.
92
+
1. Notice that it has a class `topic_explore-wikis__link`.
93
+
1. In the **Console**, execute `document.querySelector('.topic_explore-wikis__link')`. It returns element representing the top list item. The selector is apparently used only for the **Top Wikis** list, and because `document.querySelector()` returns the first matching element, we're almost done.
94
+
1. In the **Console**, execute `item = document.querySelector('.topic_explore-wikis__link')` to save the element in a variable.
95
+
1. In the **Console**, execute `item.textContent.trim()` to get the element's text without white space.
96
+
1. At the time of writing, this returns `"Pixar Wiki"`.
0 commit comments