Skip to content

Commit 36ae85f

Browse files
authored
Merge pull request #56 from jetbrains-academy/stephen-hero-patch-49
Update task.md
2 parents a46c765 + 0b5a466 commit 36ae85f

File tree

1 file changed

+8
-8
lines changed
  • page_object/first_tests_with_po/main_page

1 file changed

+8
-8
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
<h2>Page Object для главной страницы сайта</h2>
1+
<h2>Page Object for the main page of the website</h2>
22

3-
<p>Теперь реализуем Page Object, который будет связан с главной страницей интернет-магазина. </p>
3+
<p>Now let's implement a Page Object that will be associated with the main page of the online store. </p>
44

5-
<p>1. Откройте файл <code>main_page.py</code> </p>
5+
<p>1. Open the file <code>main_page.py</code> </p>
66

7-
<p>2. В нем создайте класс  <code>MainPage</code>. Его нужно сделать наследником класса <code>BasePage</code>. Класс-предок в Python указывается в скобках: </p>
7+
<p>2. In it, create a class <code>MainPage</code>. It needs to inherit from the <code>BasePage</code> class. The parent class in Python is specified in parentheses: </p>
88

99
<pre><code>class MainPage(BasePage): </code></pre>
1010

11-
<p>таким образом, класс MainPage будет иметь доступ ко всем атрибутам и методам своего класса-предка. </p>
11+
<p>This way, the MainPage class will have access to all the attributes and methods of its parent class. </p>
1212

13-
<p>3. Перенесите метод из предыдущего урока в класс <code>MainPage</code>:</p>
13+
<p>3. Copy the method from the previous lesson into the <code>MainPage</code> class:</p>
1414

1515
<pre><code>def go_to_login_page(browser):
1616
   login_link = browser.find_element(By.CSS_SELECTOR, "#login_link")
1717
login_link.click() </code></pre>
1818

19-
<p>Чтобы все работало, надо слегка видоизменить его. В аргументы больше не надо передавать экземпляр браузера, мы его передаем и сохраняем на этапе создания Page Object. Вместо него нужно указать аргумент <code>self</code, чтобы иметь доступ к атрибутам и методам класса: </p>
19+
<p>To make everything work, we need to modify it slightly. There is no need to pass the browser instance as an argument anymore; we pass and save it during the creation of the Page Object. Instead, we need to specify the <code>self</codeargument to have access to the attributes and methods of the class: </p>
2020

2121
<p><code>def go_to_login_page(self):</code></p>
2222

23-
<p>Так как браузер у нас хранится как аргумент класса <code>BasePage</code>, обращаться к нему нужно соответствующим образом с помощью <code>self</code>: </p>
23+
<p>Since our browser is stored as an argument of the <code>BasePage</code> class, you should access it appropriately using <code>self</code>: </p>
2424

2525
<pre><code class="language-python">self.browser.find_element(By.CSS_SELECTOR, "#login_link")</code></pre>

0 commit comments

Comments
 (0)