<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Cemal Yaver on Medium]]></title>
        <description><![CDATA[Stories by Cemal Yaver on Medium]]></description>
        <link>https://medium.com/@cemalyaver?source=rss-efaa159aa84c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*7C2eXhgJbIg4PHbpjPwFrQ.jpeg</url>
            <title>Stories by Cemal Yaver on Medium</title>
            <link>https://medium.com/@cemalyaver?source=rss-efaa159aa84c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 17:01:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cemalyaver/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why Should You Use Playwright for Test Automation?]]></title>
            <link>https://medium.com/@cemalyaver/why-should-you-use-playwright-35d4465d6d7e?source=rss-efaa159aa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/35d4465d6d7e</guid>
            <category><![CDATA[playwrights]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[playwright-test]]></category>
            <dc:creator><![CDATA[Cemal Yaver]]></dc:creator>
            <pubDate>Sun, 04 Jan 2026 11:01:06 GMT</pubDate>
            <atom:updated>2026-01-06T11:11:37.740Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="playwright,selenium,Why should you use Playwright?, what is playwright?" src="https://cdn-images-1.medium.com/proxy/1*h_p90-bjrre6pw9Oe7_XGw.png" /></figure><p>For many years, Selenium was the first tool that came to mind when it came to UI test automation. Many teams built large test suites on Selenium, wrote their own frameworks, and made significant investments.</p><p>However, as web applications became more dynamic and CI pipelines accelerated, problems frequently encountered in Selenium-based testing became more apparent:<br>flaky tests, long test runs, and increased maintenance costs.</p><p>This is precisely why many teams have switched from Selenium to Playwright in recent years. In this article, I will explain why <strong>Playwright is preferred</strong>, <strong>not because Selenium is “bad,” </strong>but because it solves long-standing problems more accurately.</p><p><strong>What Makes Playwright Different?</strong></p><p><strong>Playwright’s</strong> rapid rise to such a large user base isn’t due to marketing jargon, but rather to design decisions that directly address everyday test automation problems. Playwright makes not only writing tests easier, but also running and debugging them.</p><p>Below, you will find a list of reasons why you should use Playwright.</p><p><strong>1.Auto-Wait</strong></p><p>One of the most common causes of flaky tests is incorrect or incomplete waits. Playwright largely eliminates this problem</p><pre>await page.click(&#39;#loginButton&#39;);</pre><p>Before this line is executed, Playwright automatically checks</p><p>. Whether the element exists in the DOM</p><p>. Whether it is visible</p><p>. Whether it is ready to interact</p><p>This often eliminates the need to manually write wait, sleep, or complex conditions</p><p><strong>2. Built-in Parallel Test Execution</strong></p><p><strong>Playwright</strong> supports running parallel tests without requiring additional configuration</p><pre>Running 6 tests using 3 workers</pre><p>This output shows</p><p>. That tests run simultaneously</p><p>. That test duration is significantly reduced</p><p>. That feedback is received faster from CI pipelines</p><p>. There is no need to install Selenium Grid or similar solutions</p><p><strong>3. Multiple Browser Support Without Changing the Test Code</strong></p><p>In Playwright, multi-browser support is resolved at the configuration level, not at the test code level</p><p>Uses the following engines exactly</p><p><strong>- Chromium</strong></p><p><strong>- Firefox</strong></p><p><strong>- WebKit (Safari)</strong></p><p>What does this mean? Your tests run on browser engines used by real users</p><p>Common problems in Selenium, such as</p><p><strong>. “It works for me, but it’s broken in production”</strong></p><p><strong>. “It crashes in Safari”</strong></p><p>such problems are far less common in Playwright.</p><pre>// playwright.config.ts<br><br>projects: [<br>  { name: &#39;chromium&#39;, use: { browserName: &#39;chromium&#39; } },<br>  { name: &#39;firefox&#39;, use: { browserName: &#39;firefox&#39; } },<br>  { name: &#39;webkit&#39;, use: { browserName: &#39;webkit&#39; } },<br>];</pre><p><strong>4. Retry + Trace Integration</strong></p><p>In Playwright, retry isn’t just try again. Retry is part of an intelligent debugging strategy</p><pre>// playwright.config.ts<br><br>retries: 1,<br>trace: &#39;on-first-retry&#39;</pre><p>This structure;</p><p>First attempt fails → no trace is found</p><p>Retry fails → a trace is obtained</p><p>Disk doesn’t get bloated</p><p>Flaky tests are eliminated</p><p>This approach is an important standard for CI environments (Azure, GitHub Actions)</p><p><strong>When we want to do this without using retry, we need to use it like this.</strong></p><pre>// playwright.config.ts<br><br>retries: 0,<br>trace: &#39;retain-on-failure&#39;</pre><p><strong>5. Speed</strong></p><p>Playwright;</p><p>. On the same machine</p><p>. Under the same scenario</p><p>. Compared to Selenium it is noticeably faster. The reason for this; Modern architecture, WebSocket-based communication and Context-based isolation</p><p><strong>6. Storage State with Quick Scenarios</strong></p><p>Playwright allows you to store user session information (cookies, localStorage, session) as a file and reuse it later. Through storageState, instead of logging in repeatedly for each test, a pre-created session state can be used. This approach significantly reduces test time, especially in scenarios like checkout, profile, and payment, and completely eliminates flaky login steps.</p><pre>// playwright.config.ts<br><br>use: { storageState: &#39;auth.json&#39; }</pre><p>. Faster</p><p>. More stable</p><p>. Ideal for scenarios such as Login and Checkout</p><p><strong>7. Mobile Emulation (No additional tools required)</strong></p><p>Playwright doesn’t require an additional emulator, simulator, or third-party tool for mobile web testing. Thanks to the framework’s built-in mobile device profiles, tests run in a desktop environment, mimicking the behavior of a real mobile browser.</p><p>This emulation isn’t simply about reducing screen size. Playwright automatically applies mobile-specific viewport dimensions, user agent information, touch interactions, and device scaling. This provides a much more realistic mobile experience than simply opening the browser in <strong>“responsive mode.”</strong></p><p>To use mobile emulation in Playwright, simply define the relevant device profile. The same test scenario can be run for both desktop and mobile web without writing any additional code. This approach significantly reduces test maintenance costs while increasing coverage.</p><p>Mobile emulation is ideal for responsive design checks, mobile login flows, and mobile checkout scenarios. <strong>It’s not used for native mobile application testing, but rather to secure the mobile web experience</strong></p><p><strong>A Simple Mobile Emulation Example</strong></p><p>To perform mobile emulation in Playwright, simply use the <strong>“devices”</strong> definition</p><pre>// playwright.config.ts<br><br>import { defineConfig, devices } from &#39;@playwright/test&#39;;<br>export default defineConfig({<br>  projects: [<br>    {<br>      name: &#39;Mobile Chrome&#39;,<br>      use: {<br>        ...devices[&#39;Pixel 5&#39;],<br>      },<br>    },<br>  ],<br>});</pre><p>With this setup, all tests run as if they were launched from a Pixel 5 device</p><p><strong>Running Desktop and Mobile Tests with the Same Code</strong></p><p>It is possible to run the same test scenario for both desktop and mobile</p><pre>// playwright.config.ts<br><br>projects: [<br>  {<br>    name: &#39;Desktop Chrome&#39;,<br>    use: {<br>      browserName: &#39;chromium&#39;,<br>    },<br>  },<br>  {<br>    name: &#39;Mobile Safari&#39;,<br>    use: {<br>      ...devices[&#39;iPhone 13&#39;],<br>    },<br>  },<br>];</pre><p><strong>8. Modern Test Runner &amp; Clean API</strong></p><p><strong>8.1. Modern Test Runner </strong><br>Playwright doesn’t require an external runner. Test execution, reporting, parallelism, and retries are all built-in within the framework.</p><ul><li>What does it automate?</li><li>Parallel test execution</li><li>Retry (retrying a failed test)</li><li>Timeout management</li><li>Test selection using tags/grep</li><li>HTML reports, traces, videos, screenshots</li></ul><p>You don’t need to install any extra libraries for any of these.Infrastructure setups that take days in the Selenium world are reduced to minutes in Playwright.</p><p><strong>Example: Retry and Parallel</strong></p><pre>// playwright.config.ts<br><br>export default defineConfig({<br>  retries: 1,<br>  workers: 3<br>});</pre><p>With this configuration:</p><p>. A failed test will automatically rerun once.</p><p>. Tests will run in parallel with 3 workers</p><p><strong>8.2. Readable Scenarios with Test.step()</strong></p><pre>// login.spec.ts<br><br>test(&#39;User can login&#39;, async ({ page }) =&gt; {<br>  await test.step(&#39;Given user is on login page&#39;, async () =&gt; {<br>    await page.goto(&#39;/login&#39;);<br>  });<br>  await test.step(&#39;When user logs in&#39;, async () =&gt; {<br>    await page.fill(&#39;#email&#39;, &#39;test@test.com&#39;);<br>    await page.fill(&#39;#password&#39;, &#39;123456&#39;);<br>    await page.click(&#39;#login&#39;);<br>  });<br>  await test.step(&#39;Then user sees home page&#39;, async () =&gt; {<br>    await expect(page).toHaveURL(&#39;/home&#39;);<br>  });<br>});</pre><p>Through to this structure;</p><p>. The test report reads like a story.</p><p>. It’s clear at which step the failure occurred.</p><p>. Similar to BDD but not overly complex.</p><p><strong>8.3. Clean and Consistent API</strong></p><p>Playwright API;</p><p>. Short</p><p>. Predictable</p><p>. Close to natural English</p><pre>// login.page.ts<br><br>await page.click(&#39;#login&#39;);<br>await page.fill(&#39;#email&#39;, &#39;test@test.com&#39;);<br>await page.waitForURL(&#39;/home&#39;);</pre><p>. Clearly states what it does</p><p>. Does not require an extra wrapper</p><p>. Even someone without knowledge of frameworks can understand it</p><p>That’s all I have to say. Thank you for reading :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35d4465d6d7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Playwright? Playwright Setup and Test Automation with Page Object Model]]></title>
            <link>https://medium.com/@cemalyaver/what-is-playwright-playwright-setup-and-test-automation-with-page-object-model-5f10591fe88f?source=rss-efaa159aa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f10591fe88f</guid>
            <category><![CDATA[playwrights]]></category>
            <category><![CDATA[software-test-automation]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Cemal Yaver]]></dc:creator>
            <pubDate>Sun, 21 Dec 2025 08:42:36 GMT</pubDate>
            <atom:updated>2026-01-03T17:24:24.509Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/0*g0srDetOCSPyppJf.png" /></figure><p>This article will explain what <strong>Playwright</strong> is, why Playwright is preferred, then provide a step-by-step guide to setting it up from scratch, and finally, how to write clean and maintainable test automation using the <strong>Page Object Model (POM) architecture</strong>.</p><p>This article is specifically designed as a quick and clear transition guide to Playwright for test automation engineers with a Selenium/Appium background.</p><p><strong>What is Playwright?</strong></p><p><strong>Playwright</strong> is an open-source test automation framework developed by Microsoft, designed for modern web applications. It aims to reliably run the same tests on Chromium, Firefox, and WebKit (Safari engine).</p><p>Playwright offers powerful features for UI testing, end-to-end scenarios, network validations, and modern SPA applications.</p><p><strong>Why Playwright?</strong></p><ul><li>Playwright’s key advantages:</li><li>Chromium, Firefox, and WebKit support</li><li>Automatic wait (implicit retry) mechanism</li><li>No driver required</li><li>Parallel test execution</li><li>Network, storage, and cookie control</li><li>Native compatibility with CI/CD environments</li></ul><p><strong>We can now begin the installation process.</strong></p><p><strong>1. Prerequisites</strong></p><p>Your machine must have the following installed:</p><ul><li><strong>Node.js</strong></li><li><strong>npm</strong></li></ul><p>To check</p><figure><img alt="node.js,playwright" src="https://cdn-images-1.medium.com/max/912/1*-jzvONOlby3yZxDi0P8Aqg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*hx6FVj5dAQdbUUf26Oh8qA.png" /></figure><p>We saw that <strong>node.js </strong>and <strong>npm</strong> were installed.</p><p><strong>2. Creating the Playwright Project</strong></p><p>Create an empty folder and go inside it. We create a file from the terminal.</p><pre>mkdir playwright-ts-demo</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*dCjIqAJxf_InkFi-rw_Isg.png" /></figure><pre>cd playwright-ts-demo</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*B8tOFUUWQk0PwJDFcTPeQQ.png" /></figure><p>Now it’s time to start Playwright</p><pre>npm init playwright@latest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*glCpKqLKpfZ0F5Frvtp2TA.png" /></figure><p>We answer questions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_9lJVchmxes6CYuMrz0tCg.png" /></figure><p>Yes, our project was created simply and quickly :)</p><p>We will write our case studies using a simple yet professional structure with the page object model.</p><figure><img alt="playwright,test automation,web automation structure" src="https://cdn-images-1.medium.com/max/734/1*0BJP3uUt4TZYMTxbYg8DHg.png" /></figure><p>We will create this structure.</p><p>We create a <strong>login.data.ts</strong> file inside the data folder</p><p>We create our files in <strong>login.data.ts</strong> format, not <strong>loginData.ts</strong></p><p><strong>login → which feature<br>data → what type of file<br>.ts → technology</strong></p><pre>// login.data.ts<br><br>export const LoginData = {<br>  validUser: {<br>    username: &quot;test@gmail.com&quot;,<br>    password: &quot;Test123&quot;,<br>  },<br>  invalidUser: {<br>    username: &quot;testR@gmail.com&quot;,<br>    password: &quot;Test123&quot;,<br>  }<br>};</pre><p>We create a messages folder and then create a <strong>login.messages.ts</strong> file inside it</p><pre>// login.messages.ts<br><br>export const LoginMessages = {<br>  tr: {<br>    errorTitle: &quot;Beklenmeyen bir hata oluştu.&quot;,<br>    errorText: &quot;Lütfen tekrar deneyin.&quot;<br>  },<br>  en: {<br>    errorTitle: &quot;An unexpected error occurred.&quot;,<br>    errorText: &quot;Please try again.&quot;<br>  }<br>};</pre><p>Now we will create our classes. We create a pages folder and then create a <strong>base.page.ts</strong> file inside it</p><pre>// base.page.ts<br><br>import { expect, Locator, Page } from &#39;@playwright/test&#39;;<br><br>export default class BasePage {<br>  protected page: Page;<br><br>  constructor(page: Page) {<br>    this.page = page;<br>  }<br><br>  async open(path = &#39;/&#39;) {<br>    await this.page.goto(path);<br>  }<br><br>  async click(element: Locator | string) {<br>    if (typeof element === &#39;string&#39;) {<br>      await this.page.locator(element).click();<br>    } else {<br>      await element.click();<br>    }<br>  }<br><br>  async fill(element: Locator | string, value: string) {<br>    if (typeof element === &#39;string&#39;) {<br>      await this.page.fill(element, value);<br>    } else {<br>      await element.fill(value);<br>    }<br>  }<br>}</pre><p>Now we create the <strong>home.page.ts</strong> file</p><pre>// home.page.ts<br><br>import { Page, Locator } from &#39;@playwright/test&#39;;<br>import BasePage from &#39;./base.page&#39;;<br><br>export default class HomePage extends BasePage {<br>  private topLoginButton: Locator;<br>  private mainLoginButton: Locator;<br>  private title: Locator;<br><br>  constructor(page: Page) {<br>    super(page);<br>    this.title = this.page.locator(&#39;h1&#39;);<br>    this.topLoginButton = this.page.locator(&#39;//div[@id=&quot;myAccount&quot;]&#39;);<br>    this.mainLoginButton = this.page.locator(&#39;//a[@id=&quot;login&quot;]&#39;);<br>  }<br><br>  async clickLoginButton() {<br>    await this.topLoginButton.hover();<br>    await this.click(this.mainLoginButton);<br>  }<br>}</pre><p>Now we create the <strong>login.page.ts</strong> file</p><pre>// login.page.ts<br><br>import { Page, Locator } from &#39;@playwright/test&#39;;<br>import BasePage from &#39;./base.page&#39;;<br><br>export default class LoginPage extends BasePage {<br>  private emailInput: Locator;<br>  private passwordInput: Locator;<br>  private submitLoginButton: Locator;<br>  private loginErrorTitle: Locator;<br>  private loginErrorText: Locator;<br><br>  constructor(page: Page) {<br>    super(page);<br>    this.emailInput = page.locator(&#39;#txtUserName&#39;);<br>    this.passwordInput = page.locator(&#39;//input[@type=&quot;password&quot;]&#39;);<br>    this.submitLoginButton = page.locator(&#39;#btnLogin&#39;);<br>    this.loginErrorTitle = page.locator(&#39;//div[@data-test-id=&quot;inline-alert-label&quot;]&#39;);<br>    this.loginErrorText = page.locator(&#39;//div[@data-test-id=&quot;inline-alert-sub-text&quot;]&#39;);<br>  }<br><br>  async login(username: string, password: string) {<br>    await this.fill(this.emailInput, username);<br>    await this.fill(this.passwordInput, password);<br>    await this.click(this.submitLoginButton);<br>  }<br><br>  get errorTitle() {<br>    return this.loginErrorTitle;<br>  }<br><br>  get errorText() {<br>    return this.loginErrorText;<br>  }<br></pre><p>Now we are creating a <strong>tests folder</strong> for our test files. We create the <strong>login.spec.ts</strong> file</p><pre>// login.spec.ts<br><br>import { expect, test } from &#39;@playwright/test&#39;;<br>import LoginPage from &#39;../pages/login.page&#39;;<br>import HomePage from &#39;../pages/home.page&#39;;<br>import { LoginData } from &#39;../datas/login.data&#39;;<br>import { LoginMessages } from &#39;../messages/login.messages&#39;;<br><br>test.describe(&#39;Login Tests&#39;, () =&gt; {<br><br>  test(&#39;Login with Valid Credentials&#39;, async ({ page }) =&gt; {<br>    const homePage = new HomePage(page);<br>    const loginPage = new LoginPage(page);<br>    await homePage.open();<br>    await homePage.clickLoginButton();<br>    await loginPage.login(LoginData.validUser.username, LoginData.validUser.password);<br>  });<br><br>  test(&#39;Login with Invalid Credentials&#39;, async ({ page }) =&gt; {<br>    const homePage = new HomePage(page);<br>    const loginPage = new LoginPage(page);<br>    await homePage.open();<br>    await homePage.clickLoginButton();<br>    await loginPage.login(LoginData.invalidUser.username, LoginData.invalidUser.password);<br>    await expect(loginPage.errorTitle).toHaveText(LoginMessages.tr.errorTitle);<br>    await expect(loginPage.errorText).toContainText(LoginMessages.tr.errorText);<br>  });<br>});</pre><p>Now we are making our adjustments inside the <strong>playwright.config.ts</strong> file</p><pre><br>// playwright.config.ts<br><br>import { defineConfig } from &#39;@playwright/test&#39;;<br><br>export default defineConfig({<br>  testDir: &#39;./tests&#39;,<br>  timeout: 80 * 1000,<br>  retries: 1,<br><br>  use: {<br>    baseURL: process.env.BASE_URL || &#39;https://www.test.com&#39;,<br><br>    headless: false,          <br>    viewport: null,    <br>    ignoreHTTPSErrors: true,<br>    screenshot: &#39;only-on-failure&#39;,<br><br>    launchOptions: {<br>      args: [&#39;--start-maximized&#39;],<br>    },<br>  },<br><br>  projects: [<br>    { name: &#39;chromium&#39;, use: { browserName: &#39;chromium&#39; } },<br>    { name: &#39;firefox&#39;, use: { browserName: &#39;firefox&#39; } },<br>    { name: &#39;webkit&#39;, use: { browserName: &#39;webkit&#39; } },<br>  ],<br>});</pre><p>Now we are adding our settings to the <strong>tsconfig.json </strong>file</p><pre>// tsconfig.json<br><br>{<br>  &quot;compilerOptions&quot;: {<br>    &quot;target&quot;: &quot;ES2020&quot;,<br>    &quot;module&quot;: &quot;CommonJS&quot;,<br>    &quot;moduleResolution&quot;: &quot;Node&quot;,<br><br>    &quot;strict&quot;: true,<br>    &quot;esModuleInterop&quot;: true,<br>    &quot;skipLibCheck&quot;: true,<br><br>    &quot;types&quot;: [&quot;node&quot;, &quot;@playwright/test&quot;]<br>  },<br>  &quot;include&quot;: [&quot;**/*.ts&quot;],<br>  &quot;exclude&quot;: [&quot;node_modules&quot;]<br>}</pre><p>Now we type <strong>“npx playwright test”</strong> in the terminal and run our cases</p><figure><img alt="playwright, playwright with test automation,playwright with web automation" src="https://cdn-images-1.medium.com/max/1024/1*zgRnMICmCUNqssKkOHAjAA.png" /></figure><p>Our tests were successful in browsers. You can find the code on GitHub</p><p><a href="https://github.com/CemalYaver/playwright-ts-demo">GitHub - CemalYaver/playwright-ts-demo: UI test automation framework built with Playwright and TypeScript using Page Object Model</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f10591fe88f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Healenium ile Self-Healing Test Otomasyonu: Selenium & Appium için Akıllı Locator Yönetimi”]]></title>
            <link>https://medium.com/@cemalyaver/healenium-ile-self-healing-test-otomasyonu-selenium-appium-i%C3%A7in-ak%C4%B1ll%C4%B1-locator-y%C3%B6netimi-c5d46ff4799c?source=rss-efaa159aa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5d46ff4799c</guid>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[healenium-test-automation]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[healenium]]></category>
            <dc:creator><![CDATA[Cemal Yaver]]></dc:creator>
            <pubDate>Thu, 11 Sep 2025 06:46:01 GMT</pubDate>
            <atom:updated>2025-09-11T13:27:13.073Z</atom:updated>
            <content:encoded><![CDATA[<h3>Self-Healing Test Automation with Healenium: Smarter WebDriver-Based Tests (Selenium, Appium, WebdriverIO etc.)</h3><p>One of the biggest challenges in test automation is <strong>frequent UI locator changes</strong><br> When an element’s <strong>id</strong>, <strong>xpath</strong>,<strong>css </strong>etc. changes, automated tests break and fail<br> This is where <strong>Healenium</strong> comes to the rescue</p><figure><img alt="Healenium, Self-Healing Test Automation, Android Healenium, Selenium Healenium, Appium Healenium" src="https://cdn-images-1.medium.com/max/928/1*M5q6XTMj5Jydbes-CsjL1g.png" /></figure><h3>What is Healenium?</h3><p><strong>Healenium</strong> is a <strong>self-healing framework for WebDriver-based tests</strong>.</p><p>Most people assume <strong>“WebDriver-based” means <em>only</em> web automation </strong>— but that’s not the case:</p><ul><li>Both <strong>AndroidDriver</strong> and <strong>IOSDriver</strong> implement the <strong>WebDriver API</strong>.</li><li><strong>AppiumDriver</strong> is the parent class for both.</li></ul><p>That means Healenium works not only for <strong>web automation</strong> but also for <strong>mobile automation</strong> (via Appium).<br> It can also be integrated with various testing frameworks.</p><p><strong>Note:</strong><br> If a locator is missing during the <strong><em>first test run</em>,</strong> the test may still fail.<br> But on subsequent runs, <strong>Healenium’s healing mechanism kicks in</strong>.</p><h3>How Does Healenium Work?</h3><p><strong>Step 1: Test Execution</strong></p><ul><li>Automation engineer runs Selenium or Appium tests.</li><li>The code makes normal WebDriver calls.</li></ul><p><strong>Step 2: Proxy Interception</strong></p><ul><li><strong>Healenium</strong> sits as a <strong>Self-Healing Driver (Proxy)</strong> in front of the real driver.</li><li>Every <strong>findElement</strong>, <strong>click</strong>, <strong>sendKeys</strong> call is intercepted.</li><li>Locator details (<strong>ID, CSS, XPath, tag, class, text, etc.</strong>) are stored.</li></ul><p><strong>Step 3: Normal Execution</strong></p><ul><li>The proxy forwards the call to the real driver.</li><li>If the element is found → test continues normally.</li></ul><p><strong>Step 4: Healing Process</strong></p><ul><li>If the element is <strong>not found</strong>:</li></ul><ol><li>Healenium checks stored locator history</li><li>It searches for alternative matches (<strong>CSS/XPath etc.</strong>)</li><li>Each candidate element is scored with a <strong>confidence score</strong></li><li>The highest-scoring element is selected</li></ol><p><strong>Step 5: Logging &amp; Reporting</strong></p><ul><li>Healing results are saved to the backend:</li><li>Failed locator</li><li>Healed locator</li><li>Confidence score</li><li>Test Automation engineers can view reports via the <strong>Healenium Web UI</strong>.</li></ul><p><strong>Step 6: Future Tests</strong></p><ul><li>Next time the locator breaks, Healenium heals it instantly from history.</li></ul><h3>Using Healenium</h3><p>You only need one extra line of code in your existing setup</p><pre>// Standard driver<br>WebDriver delegate = new ChromeDriver(); <br><br>// Self-Healing driver<br>WebDriver driver = SelfHealingDriver.create(delegate);<br><br>driver.get(&quot;https://example.com&quot;);<br><br>// Even if locator changes, Healenium will heal it<br>driver.findElement(By.id(&quot;login-email&quot;)).sendKeys(&quot;test@example.com&quot;);</pre><h3>Benefits of Healenium</h3><p><strong>1. Self-Healing Locators</strong></p><p>Prevents test failures when UI changes.</p><p><strong>2. Detailed Reporting</strong></p><p>Failed locator, healed locator, and confidence scores are tracked.</p><p><strong>3. Works with Selenium &amp; Appium</strong></p><p>Fits seamlessly into existing automation frameworks.</p><p><strong>4. Confidence Score System</strong></p><p>Ensures the most relevant element is selected.</p><p><strong>5. Supports Dynamic Locators &amp; Parallel Tests</strong></p><p>Stable across multiple devices and viewports.</p><p><strong>6. Reduced Maintenance Cost</strong></p><p>QA teams spend less time fixing broken locators.</p><h3><strong>Setup Guide</strong></h3><p><strong>1. Get Docker Compose File</strong></p><pre>curl https://raw.githubusercontent.com/healenium/healenium-client/master/example/docker-compose.yaml -o docker-compose.yaml</pre><figure><img alt="Healenium, Self-Healing Test Automation, Android Healenium, Selenium Healenium, Appium Healenium" src="https://cdn-images-1.medium.com/max/1024/1*w7B8GwA1PDSkakL3t8FTEw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lQD1bTW4p_75SmG-uwStEQ.png" /></figure><p><strong>2. Database Init Script</strong></p><pre>curl https://raw.githubusercontent.com/healenium/healenium-client/master/example/init.sql -o init.sql</pre><figure><img alt="Healenium, Self-Healing Test Automation, Android Healenium, Selenium Healenium, Appium Healenium" src="https://cdn-images-1.medium.com/max/1024/1*exvW3yz8hMOsZBaEt9PI_A.png" /></figure><p>This creates required schema/tables on <strong>first run only</strong>. Place the<strong> init.sql</strong> file in the <strong>db -&gt;sql folder</strong></p><figure><img alt="Healenium, Self-Healing Test Automation, Android Healenium, Selenium Healenium, Appium Healenium" src="https://cdn-images-1.medium.com/max/1004/1*m5pyP9dNu6xmoACIJDu3qQ.png" /></figure><p><strong>3. Start Services</strong></p><pre>docker compose up -d</pre><figure><img alt="Healenium, Self-Healing Test Automation, Android Healenium, Selenium Healenium, Appium Healenium" src="https://cdn-images-1.medium.com/max/1024/1*_dlRtnD08umwhUN9L_ATRA.png" /></figure><p>We started the services by saying <strong>“docker compose up -d”</strong></p><ul><li>-d → Run in background</li><li>Ports:</li><li><strong>7878</strong> → Healenium backend</li><li><strong>5432</strong> → PostgreSQL</li><li><strong>8000</strong> → Selector-imitator</li></ul><figure><img alt="Healenium, Self-Healing Test Automation, Android Healenium, Selenium Healenium, Appium Healenium" src="https://cdn-images-1.medium.com/max/1024/1*eBN65DA-UiA2aFmBJSOrdw.png" /></figure><p><strong>4. Add Maven Dependency</strong></p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;com.epam.healenium&lt;/groupId&gt;<br>    &lt;artifactId&gt;healenium-web&lt;/artifactId&gt;<br>    &lt;version&gt;3.5.4&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p><strong>5. Update DriverFactory</strong></p><pre>public class DriverFactory {<br>    public static void initializeDriver(String browser) {<br>        WebDriver driver;<br>        switch (browser) {<br>            case &quot;Chrome&quot; -&gt; driver = new ChromeDriver();<br>            case &quot;Firefox&quot; -&gt; driver = new FirefoxDriver();<br>            default -&gt; throw new IllegalArgumentException(&quot;Unsupported browser: &quot; + browser);<br>        }<br><br>        // Enable self-healing<br>        driver = SelfHealingDriver.create(driver);<br>        driver.manage().window().maximize();<br>        DriverManager.setDriver(driver);<br>    }<br>}</pre><p><strong>6. Example Scenario</strong></p><pre>public void enterUsernameAndPassword() {<br>    WebDriverWait wait = new WebDriverWait(webDriver, Duration.ofSeconds(15));<br><br>    // Original locator<br>    WebElement usernameInput = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(&quot;login-email&quot;)));<br>    usernameInput.sendKeys(&quot;cemal@gmail.com&quot;);<br><br>    WebElement passwordInput = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(&quot;login-password-input&quot;)));<br>    passwordInput.sendKeys(&quot;12345&quot;);<br><br>    // Change locator via JS<br>    JavascriptExecutor js = (JavascriptExecutor) webDriver;<br>    js.executeScript(&quot;document.querySelector(&#39;#login-email&#39;).id = &#39;emailInput&#39;;&quot;);<br>    js.executeScript(&quot;document.querySelector(&#39;#login-password-input&#39;).id = &#39;passwordInput&#39;;&quot;);<br><br>    // Try original locator again → Healenium heals it<br>    WebElement usernameAfterChange = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(&quot;login-email&quot;)));<br>    usernameAfterChange.sendKeys(&quot;test@gmail.com&quot;);<br><br>    WebElement passwordAfterChange = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(&quot;login-password-input&quot;)));<br>    passwordAfterChange.sendKeys(&quot;54321&quot;);<br>}</pre><figure><img alt="Healenium, Self-Healing Test Automation, Android Healenium, Selenium Healenium, Appium Healenium" src="https://cdn-images-1.medium.com/max/958/1*jh2gKbmuky7jvpZXXWYMQA.png" /></figure><p><strong>Note :</strong> Even after changing IDs, the test passes because <strong>Healenium healed</strong> the locators. The first test run may fail if a locator is missing, but Healenium will heal it in subsequent runs using stored locator history</p><p><strong>7. Reporting</strong></p><p><strong>Open the dashboard</strong></p><pre>http://localhost:7878/</pre><p>After the page opens, we <strong>click on the reports tab</strong></p><figure><img alt="Healenium, Self-Healing Test Automation, Android Healenium, Selenium Healenium, Appium Healenium" src="https://cdn-images-1.medium.com/max/1024/1*om-WHso9svh9oMKBlRnTGA.png" /></figure><p>We can select the result at the relevant time and see the <strong>failed and healed locators</strong></p><figure><img alt="Healenium, Self-Healing Test Automation, Android Healenium, Selenium Healenium, Appium Healenium" src="https://cdn-images-1.medium.com/max/1024/1*R2c2RohCfyUDhzT5UHLTZg.png" /></figure><h3><strong>Conclusion</strong></h3><p><strong>Healenium</strong> significantly reduces <strong>test maintenance</strong> cost caused by locator changes</p><p><strong>However,</strong> it should always be combined with <strong>strong locator strategies.</strong><br>Otherwise, there’s a risk of selecting incorrect elements in complex UIs</p><p><strong>When applied correctly,</strong> Healenium is a <strong>powerful companion to Selenium &amp; Appium etc.</strong> keeping tests stable and reliable over time</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5d46ff4799c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Jmeter and how to use it?]]></title>
            <link>https://medium.com/@cemalyaver/what-is-jmeter-and-how-to-use-it-04a91eb74483?source=rss-efaa159aa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/04a91eb74483</guid>
            <category><![CDATA[apache-jmeter]]></category>
            <category><![CDATA[jmeter]]></category>
            <category><![CDATA[load-testing]]></category>
            <category><![CDATA[yük-testi]]></category>
            <dc:creator><![CDATA[Cemal Yaver]]></dc:creator>
            <pubDate>Sat, 21 Sep 2024 09:12:47 GMT</pubDate>
            <atom:updated>2024-09-22T13:25:59.427Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/800/1*TlkyKeNmtgVOzQ7B-DKxyA.jpeg" /></figure><p><strong>JMeter</strong> is a testing software tool used to run load, performance, stress and functional tests. To use Jmeter, you must have Java (JDK, JRE) installed on your computer. Developed by the Apache Software Foundation. You can find detailed information about the application at <a href="https://jmeter.apache.org/"><strong>https://jmeter.apache.org/</strong></a></p><h3>What are the features of Jmeter?</h3><p><strong>Multi-platform support:</strong> It can run on many platforms such as Windows, macOS,Linux etc<br><strong>High performance:</strong> It can allow thousands of virtual users to run test scenarios at the same time<br><strong>Support for different protocols: </strong>It can test many protocols such as HTTP,SOAP,REST, FTP, JDBC etc</p><h3>What can be done with JMeter</h3><p><strong>Performance testing: </strong>Used to test how the application or system performs under a certain load.<br><strong>Load testing: </strong>Measuring the performance and response time of the system by imposing a certain load on a web application or service.<br><strong>Stress testing: </strong>Testing the limits and fault tolerance of the system by overloading a web application or service.<br><strong>Functional testing: </strong>Testing that the functions and features of a web application or service work correctly.</p><p>You can download the Java version from <a href="https://www.java.com/tr/download/"><strong>here</strong></a> . Once the Java installation is complete, you can also download the Jmeter software from <a href="https://jmeter.apache.org/download_jmeter.cgi"><strong>here</strong></a></p><p><strong>For those using Windows operating system, the installation is as follows<br></strong>1) Open the file you downloaded from Jmeter site</p><figure><img alt="Apache jmeter, jmeter" src="https://cdn-images-1.medium.com/max/1004/1*NauJ2seS_mUvJqqhseYCzA.png" /></figure><p>2) To start Jmeter, go to Jmeter folder and go to bin folder and inside that there is a file called Jmeter.bat, click on that bat file and Jmeter will start</p><figure><img alt="Apache jmeter, jmeter" src="https://cdn-images-1.medium.com/max/934/1*wVf67-U6rYarK95cQUFiug.png" /></figure><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*dGRJ7u5VpJvmfoj_ZmuRIw.png" /></figure><p>So jmeter was opened. So jmeter was opened :)</p><p><strong>For those using macos operating system, the installation is as follows<br></strong>1) We run it on Homebrew. If it is not there, we install Homebrew from the terminal.</p><pre>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;</pre><p>2) Then we install jmeter</p><pre>brew install jmeter</pre><p>3) Let’s check if jmeter is loaded</p><pre>jmeter -v</pre><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*MCukE8eWbPDJB4Qfe8pxVg.png" /></figure><p>4) Finally, we run jmeter. We write jmeter to the terminal</p><pre>jmeter</pre><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*V7abCie4KZtVhCTsccATCg.png" /></figure><p>We have successfully run it.</p><p>I use macos operating system, I open the terminal, type jmeter and press enter, then jmeter opens</p><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*A6dw-QEeJkUNw61Mydv0Yw.png" /></figure><p>When we first open Jmeter, the <strong>Test Plan</strong> appears on the top left. Tests are executed via <strong>Test Plan. </strong>Test plans consist of elements. <strong>Each test plan must contain at least one thread group.</strong></p><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*gkDEKXPO-eUUEiaLuYZ9wA.png" /></figure><p>We will add our elements within this thread group. Right click on the test plan and <strong>Add -&gt; Threads -&gt; Thread Group</strong></p><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*_NhnlzTjK6FpmjFL_dTZcA.png" /></figure><p>After adding a thread group, the following page appears</p><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*NQK1S49nih3mYVLNiJijcA.png" /></figure><p>There are two main topics in the thread group.<br><strong>1) Action to be taken after a Sampler error: </strong>Tells how to act if any error occurs during the test execution. Usually, in performance tests, this parameter is marked as <strong>Continue</strong> and that is what we will do in this test.<br><strong>2) Thread Properties : </strong>This is the section where thread properties are defined<br>- <strong>Number of Threads (users): S</strong>imulates the number of users or connections<br>- <strong>Ramp-up period (seconds): </strong>Indicates the time it takes for all users to log into the system and for the test to end.<br>- <strong>Loop Count: </strong>Defines how many times the test will be run</p><p>For example, <strong>Thread users value: 10,</strong> <strong>ramp-up period value: 5</strong>; 10/5 = 2 users send requests per second. Since the ramp -up period value is 5<strong>,</strong> 5*2=10 user requests are sent in a total of 5 seconds. Since the <strong>loop count value is 2</strong>, 10*2=20 requests are sent. You will understand better when you make a request.</p><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*YwKOyfliCl-B2Km8HZzoEQ.png" /></figure><p>Now let’s do a simple load test with the api. <br>Let’s enter <a href="https://reqres.in/">https://reqres.in/</a> as fake data and look at our endpoints from there and do it. We will send requests to the <strong>“</strong><a href="https://reqres.in/api/users/2">https://reqres.in/api/users/2</a><strong>”</strong> endpoint</p><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*1H5aaNrJwFxtbt1hQlIljQ.png" /></figure><p>Right click on the thread group and click <strong>Add-&gt;Sampler-&gt; Http Request</strong></p><p><strong>Sampler</strong>, allows JMeter to send certan types of requests to a server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5aRJB17PdeLRWbsiLPQKJA.png" /></figure><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*wOW8j4a51y2xdAVBihKt7A.png" /></figure><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*-Jgr8T6bKAV7gg4vG94iOQ.png" /></figure><p>Let’s enter our endpoint as shown in the picture</p><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*dVvSt82TjoDje56jbagXwQ.png" /></figure><p>We have entered our request as http request. Now we will use listeners to display our request.<br>Right click on the thread group and click <strong>Add-&gt;Listener-&gt; View Results Tree</strong></p><p><strong>Listener</strong> allows you to view the results of requests made by Samplers in tables, graphs, tree-type structures, or log format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9VvDYjKEG_4WIkdtcsHE_Q.png" /></figure><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*kFCZfFepV-2omJqh4lvN-Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y-4g_B19vk1w67hrCZi5MQ.png" /></figure><p>We will see our results in <strong>View Results Tree.<br></strong>When we press the green start button at the top, we start sending our requests. Our requests were successful and a green tick was shown. If the request was unsuccessful, a red cross would have been shown.</p><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*GNn7fd_-9iPvNwJEz56obA.png" /></figure><p>We can see the result when we press any request.</p><figure><img alt="Apache jmeter, jmeter , how to use jmeter, load test" src="https://cdn-images-1.medium.com/max/1024/1*6aRJaI7HSnp25eqTzz5q8A.png" /></figure><p>Like this, we have done our simple test with jmeter. See you in other posts :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04a91eb74483" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running both android and ios automation with browserstack integration through a single project]]></title>
            <link>https://medium.com/@cemalyaver/running-both-android-and-ios-automation-with-browserstack-integration-through-a-single-project-382e0f7463a6?source=rss-efaa159aa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/382e0f7463a6</guid>
            <category><![CDATA[appium]]></category>
            <category><![CDATA[browserstack-app-testing]]></category>
            <category><![CDATA[mobile-browserstack]]></category>
            <category><![CDATA[browserstack-integration]]></category>
            <dc:creator><![CDATA[Cemal Yaver]]></dc:creator>
            <pubDate>Tue, 18 Jul 2023 08:20:42 GMT</pubDate>
            <atom:updated>2024-05-06T10:48:50.672Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Android automate,Ios automate,mobile automation browserstack" src="https://cdn-images-1.medium.com/max/1024/1*Qx3nGXodby6CCb2uCw4zEg.png" /></figure><p>Hello everyone. Today, we will look at running both android and ios automation with browserstack integration through a single project.</p><p>First we go to <a href="https://www.browserstack.com/">https://www.browserstack.com</a> <br>Then we press the free trial button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jw_wvIw4-wbrV9ffpDIXxA.png" /></figure><p>You can login with your google account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0n6zMWh5HiSJPso73nROeA.png" /></figure><p>Press the “<strong>App</strong>” tab from the left menu and then press “<strong>App Automate</strong>”</p><figure><img alt="App automate,browserstack, App automate browserstack" src="https://cdn-images-1.medium.com/max/482/1*Lq8Gfvpdbpy9L21ETxA2gA.png" /></figure><p>We install android and/or ios app by pressing the “<strong>Upload App</strong>” button from the top</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hqOk8iulNbNe_q6LORjUow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*jrLDPVpaBjDbHEzTR291qw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*WNgC-ey2JjquailrnZ7n4Q.png" /></figure><p>We will use this url to show app in capabilities section. Then we get the <strong>User Name</strong> and <strong>Access Key</strong> values to connect to the remote server by pressing the access key button.</p><figure><img alt="browserstack mobile automation" src="https://cdn-images-1.medium.com/max/592/1*amgDzpW26BhBsUaAIfzjZw.png" /></figure><p>We have installed both android and ios apps. Your username and access key values are the same. We now have values so we can integrate with browserstack. We will use these values in hook class</p><p>We use cucumber as bdd. We will login via email<br>features folder -&gt; <strong>Login.feature</strong></p><pre>Feature: Login<br> Scenario: Transfer by paying with a wallet<br>    Given Click &quot;Profil&quot; at navigation bar at commonHomePage<br>    And Click Login-Register button at loginPage<br>    And Login with email &quot;test@gmail.com&quot; &quot;Test12345&quot; at loginPage</pre><p>helper folder -&gt; <strong>AndroidHelper.class</strong></p><pre>public class AndroidHelper extends Hooks {<br><br>    public AndroidHelper() {<br>        PageFactory.initElements(new AppiumFieldDecorator(androidDriver), this);<br>    }</pre><p>helper folder -&gt; <strong>IosHelper.class</strong></p><pre>public class IosHelper extends Hooks {<br><br>    public IosHelper() {<br>        PageFactory.initElements(new AppiumFieldDecorator(iosDriver), this);<br>    }</pre><p>stepDefinition folder-&gt; <strong>Hooks.class</strong></p><p>We assign the browserstack values to the variables inside the hooks class.</p><p>You can check the capabilities settings here<br><a href="https://www.browserstack.com/app-automate/capabilities">https://www.browserstack.com/app-automate/capabilities</a></p><figure><img alt="android capabilities, ios capabilities," src="https://cdn-images-1.medium.com/max/1024/1*72Fm0_Qv3mif5KxNQ-vqhQ.png" /></figure><pre>public class Hooks {<br><br>    public static AndroidDriver androidDriver;<br>    public static IOSDriver iosDriver;<br><br>    public static final String UserName =&quot;testxxxxxxxxxxxx&quot;;<br>    public static final String AccessKey =&quot;KgXxxxxxxxxxxxx&quot;;<br>    public static final String URL = &quot;https://&quot; + UserName + &quot;:&quot; + AccessKey +  &quot;@hub-cloud.browserstack.com/wd/hub&quot;;<br><br>    @Before<br>    public static void setUp() throws MalformedURLException {<br>        DesiredCapabilities capabilities = new DesiredCapabilities();<br>        if (Runner.isAndroid()) {<br>            capabilities.setCapability(&quot;os_version&quot;, &quot;11&quot;);<br>            capabilities.setCapability(&quot;device&quot;,&quot;Samsung Galaxy S21&quot;);<br>            capabilities.setCapability(&quot;app&quot;,&quot;bs://0db2xxxxxxxxxxxxxxxxxx&quot;);<br>            capabilities.setCapability(&quot;language&quot;, &quot;tr&quot;);<br>            capabilities.setCapability(&quot;locale&quot;, &quot;tr&quot;);<br>            androidDriver = new AndroidDriver(new URL(URL),capabilities);<br>        }<br>        else {<br>            capabilities.setCapability(&quot;os_version&quot;, &quot;16&quot;);<br>            capabilities.setCapability(&quot;device&quot;, &quot;iPhone 14&quot;);<br>            capabilities.setCapability(&quot;app&quot;,&quot;bs://63cxxxxxxxxxxxxxxxxxx&quot;);<br>            capabilities.setCapability(&quot;language&quot;, &quot;tr&quot;);<br>            capabilities.setCapability(&quot;locale&quot;, &quot;tr&quot;);<br>            iosDriver = new IOSDriver(new URL(URL),capabilities);<br>        }<br>    }<br><br>    @After<br>    public void quit() {<br>        if (Runner.isAndroid()) {<br>            androidDriver.quit();<br>        } else iosDriver.quit();<br>    }<br>}</pre><p>runners folder -&gt;<strong> Runner.class</strong></p><pre>@CucumberOptions(features = &quot;src/test/java/features&quot;, glue = {&quot;stepDefinition&quot;})<br>public class Runner extends AbstractTestNGCucumberTests {<br><br>  public String platformVersion;<br><br>    @Parameters({&quot;platformVersion&quot;})<br>    public Runner(String platformVersion) {<br>        this.deviceName = platformVersion;<br>    }<br><br>    public static boolean isAndroid() {<br>        if (platformVersion.equalsIgnoreCase(&quot;ANDROID&quot;)) {<br>            return true;<br>        } else {<br>            return false;<br>        }<br>    }<br>}</pre><p>stepDefinition folder-&gt; <strong>HomePageStep.class</strong></p><pre>public class HomePageStep {<br><br>    AndroidHomePage androidHomePage;<br>    IosHomePage iosHomePage;<br><br>    public CommonHomePageStep() {<br>        if (Runner.isAndroid()) {<br>            androidHomePage = new AndroidHomePage();<br>        }<br>        else{<br>            iosHomePage = new IosHomePage();<br>        }<br>    }<br><br> @Given(&quot;Click {string} at navigation bar at commonHomePage&quot;)<br>    public void clickNavigationBar(String menu) {<br>        if (Runner.isAndroid()) {<br>            androidCommonHomePage.clickNavigationBar(menu);<br>        } else {<br>            iosHomePage.clickavigationBar(menu);<br>        }<br>    }</pre><p>pages folder-&gt; android folder-&gt; <strong>AndroidHomePage.class</strong></p><pre>public class AndroidHomePage extends AndroidHelper {<br><br>    @AndroidFindBy(xpath = &quot;//android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout&quot;)<br>    private List&lt;AndroidElement&gt; navigationBar;<br><br>    public void clickNavigationBar(String menu) {<br>        System.out.println(&quot;Click navigation bar&quot;);<br>        for (AndroidElement element : navigationBar) {<br>            if (element.getAttribute(&quot;content-desc&quot;).equals(menu)) {<br>                element.click();<br>                break;<br>            }<br>        }<br>    }</pre><p>pages folder -&gt; ios folder -&gt; <strong>IosHomePage.class</strong></p><pre>public class IosHomePage extends IosHelper {<br><br>    @iOSXCUITFindBy(xpath = &quot;//XCUIElementTypeButton&quot;)<br>    private List&lt;IOSElement&gt; navigationBar;<br><br>    public void clickNavigationBar(String menu) {<br>        System.out.println(&quot;Click navigation bar&quot;);<br>        for (IOSElement element : navigationBar) {<br>            if (element.getAttribute(&quot;name&quot;).equals(menu)) {<br>                element.click();<br>                break;<br>            }<br>        }<br>    }<br>}</pre><p>stepDefinition folder-&gt; <strong>LoginPageStep.class</strong></p><pre>public class LoginPageStep {<br><br>    AndroidLoginPage androidLoginPage;<br>    IosLoginPage iosLoginPage;<br><br>    public LoginPageStep() {<br>        if (Runner.isAndroid()) {<br>            androidLoginPage = new AndroidLoginPage();<br>        } else iosLoginPage = new IosLoginPage();<br>    }<br><br>    @And(&quot;Click Login-Register button at loginPage&quot;)<br>    public void clickLoginRegisterButton() {<br>        if (Runner.isAndroid()) {<br>            androidLoginPage.clickLoginRegister();<br>        } else iosLoginPage.clickLoginRegister();<br>    }<br><br>    @And(&quot;Login with email {string} {string} at loginPage&quot;)<br>    public void loginWithEmail(String email, String password) {<br>        if (Runner.isAndroid()) {<br>            androidLoginPage.loginWithEmail(email, password);<br>        } else iosLoginPage.loginWithEmail(email, password);<br>    }<br>}</pre><p>pages folder-&gt; android folder-&gt; <strong>AndroidLoginPage.class</strong></p><pre>public class AndroidLoginPage extends Helper {<br><br>    @AndroidFindBy(id = &quot;btnLoginRegister&quot;)<br>    private AndroidElement loginRegisterButton;<br><br>    @AndroidFindBy(id = &quot;et_email&quot;)<br>    private AndroidElement emailEditText;<br><br>    @AndroidFindBy(id = &quot;btnContinue&quot;)<br>    private AndroidElement emailWithContinueButton;<br><br>    @AndroidFindBy(id = &quot;et_password&quot;)<br>    private AndroidElement passwordEditText;<br><br>    public void clickLoginRegister() {<br>        System.out.println(&quot;Click login register button&quot;);<br>        loginRegisterButton.click();<br>    }<br><br>    public void loginWithEmail(String email, String password) {<br>        System.out.println(&quot;Login with email &quot; + email + &quot; &quot; + password);<br>        emailEditText.sendKeys(email);<br>        emailWithContinueButton.click();<br>        passwordEditText.sendKeys(password);<br>        emailWithContinueButton.click();<br>    }<br>}</pre><p>pages folder-&gt; android folder-&gt; <strong>IosLoginPage.class</strong></p><pre>public class IosLoginPage extends IosHelper {<br>    <br>    @iOSXCUITFindBy(xpath = &quot;//XCUIElementTypeButton[@name=&#39;Giriş Yap&#39;]&quot;)<br>    private IOSElement loginRegisterButton;<br><br>    @iOSXCUITFindBy(xpath = &quot;//XCUIElementTypeTextField[@value=&#39;E-posta adresi&#39;]&quot;)<br>    private IOSElement emailTextbox;<br><br>    @iOSXCUITFindBy(xpath = &quot;//XCUIElementTypeButton[@name=&#39;arrow right&#39;]&quot;)<br>    private IOSElement arrowButton;<br><br>    @iOSXCUITFindBy(xpath = &quot;//XCUIElementTypeSecureTextField[@value=&#39;Şifre&#39;]&quot;)<br>    private IOSElement passwordTextbox;<br><br>    @iOSXCUITFindBy(xpath = &quot;//XCUIElementTypeStaticText[@value=&#39;Giriş Yap&#39;]&quot;)<br>    private IOSElement loginButton;<br><br>    public void clickLoginRegister() {<br>        System.out.println(&quot;Click login register button&quot;);<br>        loginRegisterButton.click();<br>    }<br><br>    public void loginWithEmail(String email, String password) {<br>        System.out.println(&quot;Login with email &quot; + email + &quot; &quot; + password);<br>        emailTextbox.sendKeys(email);<br>        arrowButton.click();<br>        passwordTextbox.sendKeys(password);<br>        loginButton.click();<br>    }<br>}</pre><p><strong>AndroidTestng.xml</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE suite SYSTEM &quot;http://testng.org/testng-1.0.dtd&quot;&gt;<br>&lt;suite name=&quot;Test Suite&quot;&gt;<br>   &lt;test name=&quot;AndroidLogin&quot;&gt;<br>        &lt;parameter name=&quot;platformVersion&quot; value=&quot;ANDROID&quot;/&gt;<br>        &lt;classes&gt;<br>            &lt;class name=&quot;runners.Runner&quot;/&gt;<br>        &lt;/classes&gt;<br>    &lt;/test&gt;<br>&lt;/suite&gt;</pre><p><strong>IOSTestng.xml</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE suite SYSTEM &quot;http://testng.org/testng-1.0.dtd&quot;&gt;<br>&lt;suite name=&quot;Test Suite&quot;&gt;<br>&lt;test name=&quot;IOSLogin&quot;&gt;<br>        &lt;parameter name=&quot;platformVersion&quot; value=&quot;IOS&quot;/&gt;<br>        &lt;classes&gt;<br>            &lt;class name=&quot;runners.Runner&quot;/&gt;<br>        &lt;/classes&gt;<br>    &lt;/test&gt;<br>&lt;/suite&gt;</pre><p>Pom.xml</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;<br>         xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>         xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;<br>    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;<br><br>    &lt;groupId&gt;com.biletdukkani&lt;/groupId&gt;<br>    &lt;artifactId&gt;b2c&lt;/artifactId&gt;<br>    &lt;version&gt;1.0&lt;/version&gt;<br><br>    &lt;properties&gt;<br>        &lt;maven.compiler.source&gt;11&lt;/maven.compiler.source&gt;<br>        &lt;maven.compiler.target&gt;11&lt;/maven.compiler.target&gt;<br>    &lt;/properties&gt;<br><br>    &lt;build&gt;<br>        &lt;plugins&gt;<br>            &lt;plugin&gt;<br>                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>                &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;<br>                &lt;version&gt;3.0.0-M5&lt;/version&gt;<br>                &lt;configuration&gt;<br>                    &lt;suiteXmlFiles&gt;<br>                        &lt;!--suppress UnresolvedMavenProperty --&gt;<br>                        &lt;suiteXmlFile&gt;${suiteXmlFile}&lt;/suiteXmlFile&gt;<br>                    &lt;/suiteXmlFiles&gt;<br>                &lt;/configuration&gt;<br>            &lt;/plugin&gt;<br>        &lt;/plugins&gt;<br>    &lt;/build&gt;<br><br>    &lt;dependencies&gt;<br><br>        &lt;dependency&gt;<br>            &lt;groupId&gt;io.cucumber&lt;/groupId&gt;<br>            &lt;artifactId&gt;cucumber-testng&lt;/artifactId&gt;<br>            &lt;version&gt;7.5.0&lt;/version&gt;<br>        &lt;/dependency&gt;<br><br>        &lt;dependency&gt;<br>            &lt;groupId&gt;io.appium&lt;/groupId&gt;<br>            &lt;artifactId&gt;java-client&lt;/artifactId&gt;<br>            &lt;version&gt;7.5.1&lt;/version&gt;<br>        &lt;/dependency&gt;<br><br>        &lt;dependency&gt;<br>            &lt;groupId&gt;io.cucumber&lt;/groupId&gt;<br>            &lt;artifactId&gt;cucumber-java&lt;/artifactId&gt;<br>            &lt;version&gt;7.11.2&lt;/version&gt;<br>        &lt;/dependency&gt;<br><br>    &lt;/dependencies&gt;<br><br>&lt;/project&gt;</pre><p>Let’s run AndroidTestng.xml</p><p>Build took and worked successfully :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kj84d0agIuVdQ59YlNh31w.png" /></figure><p>Let’s run IOSTestng.xml</p><p>Build took and worked successfully :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iCyZf3bSq77hu1YpM70tJg.png" /></figure><p>See you in another post take care</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=382e0f7463a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate ios device with Appium]]></title>
            <link>https://medium.com/@cemalyaver/automate-ios-device-with-appium-48b5c4ea03ab?source=rss-efaa159aa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/48b5c4ea03ab</guid>
            <category><![CDATA[appium]]></category>
            <category><![CDATA[mobile-automation]]></category>
            <category><![CDATA[appium-ios-automation]]></category>
            <category><![CDATA[automate-ios-device]]></category>
            <category><![CDATA[ios-test-automation]]></category>
            <dc:creator><![CDATA[Cemal Yaver]]></dc:creator>
            <pubDate>Tue, 27 Dec 2022 13:48:49 GMT</pubDate>
            <atom:updated>2025-02-12T09:57:42.247Z</atom:updated>
            <content:encoded><![CDATA[<p>We will see with you to automate your application on IOS. Before we start we need to install the following.</p><ul><li><strong>Appium</strong></li><li><strong>IntelliJ</strong></li><li><strong>Xcode</strong></li><li><strong>Simulator</strong></li><li><strong>Appium Inspector<em>(</em>we use to find the elements<em>)</em></strong></li></ul><p>We will use cucumber as bdd. We will do it using the Page object model structure and we will use java as the language. We will see how to login from the application. So let’s start</p><p><strong>Create a maven project. File -&gt; New -&gt; Project</strong></p><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/0*srPNbEIoX2w0aPv2" /></figure><p>We will make the necessary definitions from pom.xml It can be found by searching at <a href="https://mvnrepository.com/">https://mvnrepository.com/</a></p><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/0*DgkW3ZYr5BIlY5Jf" /></figure><p><strong>We add it to the pom.xml file</strong></p><pre>&lt;dependencies&gt;<br>  <br>&lt;dependency&gt;<br>    &lt;groupId&gt;io.cucumber&lt;/groupId&gt;<br>    &lt;artifactId&gt;cucumber-testng&lt;/artifactId&gt;<br>    &lt;version&gt;7.5.0&lt;/version&gt;<br>&lt;/dependency&gt;<br><br>&lt;dependency&gt;<br>    &lt;groupId&gt;io.appium&lt;/groupId&gt;<br>    &lt;artifactId&gt;java-client&lt;/artifactId&gt;<br>    &lt;version&gt;7.5.1&lt;/version&gt;<br>&lt;/dependency&gt;<br><br><br>&lt;dependency&gt;<br>    &lt;groupId&gt;io.cucumber&lt;/groupId&gt;<br>    &lt;artifactId&gt;cucumber-java&lt;/artifactId&gt;<br>    &lt;version&gt;7.9.0&lt;/version&gt;<br>&lt;/dependency&gt;<br><br><br>&lt;/dependencies&gt;</pre><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/0*4oJMoRLK61lVgiSV" /></figure><p><strong>We will create a feature file to write our cases.</strong></p><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/0*fz3mKFj9bQwKuXQu" /></figure><pre>Feature: Login<br><br> Scenario: Login with username and password<br><br>   Given Click &quot;Profil&quot; at navigation bar<br>   And Click Login-Register button at loginPage<br>   And Login with email &quot;cemal@test.com&quot; &quot;12345&quot; at loginPage</pre><p><strong>We will create the testng.xml file and trigger the runner class from there.</strong></p><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/0*2U8pL9Tyy3nRgwr7" /></figure><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE suite SYSTEM &quot;http://testng.org/testng-1.0.dtd&quot;&gt;<br>&lt;suite name=&quot;Practice Suite&quot;&gt;<br>   &lt;test name=&quot;Test&quot;&gt;<br>       &lt;parameter name=&quot;platformVersion&quot; value=&quot;iOS&quot;/&gt;<br>       &lt;parameter name=&quot;port&quot; value=&quot;4723&quot;/&gt;<br>       &lt;parameter name=&quot;uId&quot; value=&quot;com.xx.xxx&quot;/&gt;<br>       &lt;classes&gt;<br>           &lt;class name=&quot;runners.Runner&quot;/&gt;<br>       &lt;/classes&gt;<br>   &lt;/test&gt;<br>&lt;/suite&gt;</pre><p><strong>Now let’s create our runner class</strong></p><pre>@CucumberOptions(features = &quot;src/test/java/features&quot;, glue = {&quot;stepDefinition&quot;})<br>public class Runner extends AbstractTestNGCucumberTests {<br><br>   public final static ThreadLocal&lt;String&gt; platform = new ThreadLocal&lt;&gt;();<br>   public final static ThreadLocal&lt;String&gt; port = new ThreadLocal&lt;&gt;();<br>   public final static ThreadLocal&lt;String&gt; uId = new ThreadLocal&lt;&gt;();<br><br>   @BeforeTest<br>   @Parameters({&quot;platformVersion&quot;, &quot;port&quot;, &quot;uId&quot;})<br>   public void test(String platform, @Optional(&quot;portNumber&quot;) String portNumber, String uId) {<br>       Runner.platform.set(platform);<br>       Runner.port.set(portNumber);<br>       Runner.uId.set(uId);<br>       System.out.println(platform);<br>   }<br>}</pre><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/0*UNTonSdQso8lfacz" /></figure><p><strong>We create hooks class</strong></p><pre>public class Hooks {<br><br>   public static AppiumDriver driver;<br><br>   @Before<br>   public static void setUp() {<br>       String portNumber = Runner.port.get();<br>       String uId = Runner.uId.get();<br>       DesiredCapabilities capabilities = new DesiredCapabilities();<br>       capabilities.setCapability(IOSMobileCapabilityType.PLATFORM_NAME, Platform.IOS);<br>       capabilities.setCapability(IOSMobileCapabilityType.BUNDLE_ID, uId);<br>       capabilities.setCapability(&quot;automationName&quot;, &quot;XCUITest&quot;);<br>       capabilities.setCapability(&quot;platformVersion&quot;, &quot;15.2&quot;);<br>       capabilities.setCapability(&quot;deviceName&quot;, &quot;iPhone 12&quot;);<br><br>       try {<br>           driver = new AppiumDriver(new URL(&quot;http://127.0.0.1:&quot; + portNumber + &quot;/wd/hub&quot;), capabilities);<br>       } catch (MalformedURLException e) {<br>           e.printStackTrace();<br>       }<br>       driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);<br>   }<br><br>   @After<br>   public void quit() {<br>       driver.quit();<br>   }<br>}</pre><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/0*t-GRB8fC0b3txuCM" /></figure><p>You will see features and glue in the cucumber options section.</p><p><strong>Features :</strong> The path of the feature file to be run is shown<br><strong>Glue</strong> : We show the path of the step definition file with the Glue parameter.</p><p><strong>Why Cucumber Hooks<br></strong>With Hooks, you can add codes that will work before / after. For example, we will start and close the driver in after/before, as we would have done.</p><p><strong>Now, We create step definition files</strong></p><pre>public class HomePageStep {<br><br>   HomePage homePage = new HomePage();<br><br>   @Given(&quot;Click {string} at navigation bar&quot;)<br>   public void clickNavigationBar(String menu) {<br>       homePage.clickNavigationBar(menu);<br>   }<br>}</pre><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/902/0*Xgq2sNxJokUNLIkh" /></figure><p><strong>We create the page class</strong></p><pre>public class HomePage extends Helper {<br><br>   @iOSXCUITFindBy(xpath = &quot;//XCUIElementTypeButton&quot;)<br>   private List&lt;MobileElement&gt; navigationBar;<br><br>   public void clickNavigationBar(String menu) {<br>       System.out.println(&quot;Click navigation bar&quot;);<br>       for (MobileElement element : navigationBar) {<br>           if (element.getAttribute(&quot;content-desc&quot;).equals(menu)) {<br>               element.click();<br>               break;<br>           }<br>       }<br>   }<br>}</pre><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/0*fcLOAlvIOwBKqRMC" /></figure><p>Let’s say why we extend the Helper class 🙂 I used it for page factory.</p><p>You can check this article <br><a href="https://medium.com/@cemalyaver/page-object-model-with-page-factory-46a3bc812fbd">https://medium.com/@cemalyaver/page-object-model-with-page-factory-46a3bc812fbd</a></p><pre>public class Helper extends Hooks {<br><br>   public Helper() {<br>      PageFactory.initElements(new AppiumFieldDecorator(driver), this);<br>   }<br>}</pre><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/0*MiDhLJTSqbYSjjFc" /></figure><p>Now our structure is ready, we can add steps :)<br> Now let’s write our codes for the “<strong>Click Login-Register button at login Page</strong>” step</p><p><strong>stepDefinition folder-&gt; LoginPageStep.class</strong></p><pre>public class LoginPageStep {<br><br>   LoginPage loginPage = new LoginPage();<br><br>   @And(&quot;Click Login-Register button at loginPage&quot;)<br>   public void clickLoginRegisterButton() {<br>       loginPage.clickLoginRegister();<br>   }<br>}</pre><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/952/0*STGM7hIqOwpRa5KE" /></figure><p><strong>pages folder -&gt; LoginPage.class</strong></p><pre>public class LoginPage extends Helper {<br><br>   @iOSXCUITFindBy(xpath = &quot;//XCUIElementTypeButton[@name=&#39;Giriş Yap&#39;]&quot;)<br>   private MobileElement loginRegisterButton;<br><br>   public void clickLoginRegister() {<br>       System.out.println(&quot;Click login register button&quot;);<br>       loginRegisterButton.click();<br>   }<br>}</pre><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/0*E-mzRe8NY3UWc051" /></figure><p>Now let’s write our codes for the<br><strong> Login with email “cemal@test.com” “12345” at loginPage </strong>step</p><p><strong>stepDefinition folder -&gt; LoginPageStep.class inside</strong></p><pre>@And(&quot;Login with email {string} {string} at loginPage&quot;)<br>public void loginWithEmail(String email, String password) {<br>       loginPage.loginWithEmail(email, password);<br>}</pre><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/0*xalx6IbnE3pB3a00" /></figure><p><strong>pages folder -&gt; LoginPage.class inside</strong></p><pre>@iOSXCUITFindBy(xpath = &quot;//XCUIElementTypeTextField[@value=&#39;E-posta adresi&#39;]&quot;)<br>private MobileElement emailTextbox;<br><br>@iOSXCUITFindBy(xpath = &quot;//XCUIElementTypeButton[@name=&#39;arrow right&#39;]&quot;)<br>private MobileElement arrowButton;<br><br>@iOSXCUITFindBy(xpath = &quot;//XCUIElementTypeSecureTextField[@value=&#39;Şifre&#39;]&quot;)<br>private MobileElement passwordTextbox;<br><br>@iOSXCUITFindBy(xpath = &quot;//XCUIElementTypeStaticText[@value=&#39;Giriş Yap&#39;]&quot;)<br>private MobileElement loginButton;<br><br>public void loginWithEmail(String email, String password) {<br>   System.out.println(&quot;Login with email &quot; + email + &quot; &quot; + password);<br>   emailTextbox.sendKeys(email);<br>   arrowButton.click();<br>   passwordTextbox.sendKeys(password);<br>   loginButton.click();<br>}</pre><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/0*FS_Cfi1R0qq4A3LE" /></figure><p><strong>Our project structure will be like this :)</strong></p><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/862/1*cS03_xwu5dmcq0_Pda22Ww.png" /></figure><p><strong>Right click on testng.xml file and run</strong></p><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/1*Q3djmsiZvoWUTQjOsRaEFg.png" /></figure><figure><img alt="apppium,appium ios,cucumber,bdd,mobile automation" src="https://cdn-images-1.medium.com/max/1024/1*LxAtNeLYnvYyWR47mrB2Rw.png" /></figure><p>Worked successfully :) See you in another post take care :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48b5c4ea03ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use CSS Selectors in Selenium]]></title>
            <link>https://medium.com/@cemalyaver/how-to-use-css-selectors-in-selenium-225732f58542?source=rss-efaa159aa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/225732f58542</guid>
            <dc:creator><![CDATA[Cemal Yaver]]></dc:creator>
            <pubDate>Mon, 13 Dec 2021 11:02:59 GMT</pubDate>
            <atom:updated>2021-12-15T11:47:38.887Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, Today we will see with you the use of selenium css selector. I divided the element finding method with css selector into 7 parts</p><ul><li><strong>Tag and ID</strong></li><li><strong>Tag and class</strong></li><li><strong>Tag and attribute</strong></li><li><strong>Attribute contains</strong></li><li><strong>Nth-of-type(index)</strong></li><li><strong>Last-of-type</strong></li><li><strong>First-of-type</strong></li></ul><h3><strong>1) Tag and ID</strong></h3><p>Now let’s look at the use of Tag and ID</p><p><strong>Syntax : </strong>css=<em>tag</em>#<em>id</em></p><p><strong>Description :</strong></p><ul><li><strong>tag</strong> = the HTML tag of the element being accessed</li><li><strong># </strong>= the hash sign. This should always be present when using a Selenium CSS Selector with ID</li><li><strong>id</strong> = the ID of the element being accessed</li></ul><p>We login to Amazon.com. Then we press the sign in button.Sign in page is coming</p><figure><img alt="css selector,selenium css selector,Tag and ID,selenium tag and id" src="https://cdn-images-1.medium.com/max/1024/1*md5tcxHfakvJo9kET67q7w.png" /></figure><pre>input#ap_email</pre><h3><strong>2) Tag and Class</strong></h3><p>Now let’s look at the use of Tag and Class</p><p><strong>Syntax : </strong>css<strong>= </strong><em>tag</em>.<em>class</em></p><p><strong>Description :</strong></p><ul><li><strong>tag </strong>= the HTML tag of the element being accessed</li><li><strong>.</strong> = the dot sign. This should always be present when using a CSS Selector with class</li><li><strong>class</strong> = the class of the element being accessed</li></ul><figure><img alt="css selector,css selector Tag and Class, selenium css selector tag and class" src="https://cdn-images-1.medium.com/max/1024/1*fvBs9IpSXoW4y7KVkL2Owg.png" /></figure><pre>a.a-button-text</pre><h3>3) Tag and Attribute</h3><p>Now let’s look at the use of Tag and Attribute</p><p><strong>Syntax : </strong>css=<em>tag</em>[<em>attribute</em>=<em>value</em>]</p><p><strong>Description :</strong></p><ul><li><strong>tag </strong>= the HTML tag of the element being accessed</li><li><strong>attribute</strong> = the attribute to be used. It is advisable to use an attribute that is unique to the element such as a name or ID.</li><li><strong>value</strong> = the corresponding value of the chosen attribute.</li></ul><figure><img alt="Css selector, css selector, selenium css selector, selenium Tag and Attribute,selenium tag and attribute" src="https://cdn-images-1.medium.com/max/1024/1*az1yGxMwX9jFh-hYPWmE5A.png" /></figure><pre>input[id=&#39;ap_email&#39;]</pre><h3>4) Attribute contains</h3><p>Now let’s look at the use of attribute contains</p><p><strong>Syntax : </strong>css=[attribute*=value]</p><p><strong>Description :</strong></p><ul><li><strong>attribute</strong> = the attribute to be used. It is advisable to use an attribute that is unique to the element such as a name or ID.</li><li><strong>*= </strong>looks at what’s inside the attribute</li><li><strong>value</strong> = the corresponding value of the chosen attribute.</li></ul><figure><img alt="css selector,selenium css,Attribute contains,selenium attribute contains" src="https://cdn-images-1.medium.com/max/1024/1*xiLizS8mCNdAPMyV6O13Zw.png" /></figure><pre>[class*=&#39;auth-autofocus&#39;]</pre><h3><strong>5) Nth-of-type(index)</strong></h3><p>Now let’s look at the use of nth-of-type(index). Index starts from 1</p><p>Go to <a href="https://www.bbc.com/news">https://www.bbc.com/news</a> and look at the top menus. For example, let’s find the third menu</p><figure><img alt="css selector,selenium css selector,Nth-of-type,selenium nth-of-type, css nth-of-type" src="https://cdn-images-1.medium.com/max/1024/1*0HXmqwoUV1IsTvoNb3L-bw.png" /></figure><pre>[class*=&#39;wide-sections&#39;] [class*=&#39;list-ui__item&#39;]:nth-child(3)</pre><p>or we can do it like this</p><pre>[class*=&#39;wide-sections&#39;] li:nth-child(3)</pre><h3>6) <strong>Last-of-type</strong></h3><p>We use Last-of-type when we want to find the last element</p><figure><img alt="Css selector, css selector selenium, Last-of-type, Selenium Last-of-type,Selenium last-of-type" src="https://cdn-images-1.medium.com/max/1024/1*XI3qrkqESpy9nVyWbOElLA.png" /></figure><pre>[class*=&#39;wide-sections&#39;] li:last-of-type</pre><h3>7) <strong>First-of-type</strong></h3><p>First-of-type is used when we want to find the first element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puRTKZjRrQ0pUJ03Te2A-A.png" /></figure><pre>[class*=&#39;wide-sections&#39;] li:first-of-type</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=225732f58542" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The use of cucumber with selenium]]></title>
            <link>https://medium.com/@cemalyaver/the-use-of-cucumber-with-selenium-83ae64c6939d?source=rss-efaa159aa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/83ae64c6939d</guid>
            <category><![CDATA[bdd-cucumber]]></category>
            <category><![CDATA[cucumber]]></category>
            <category><![CDATA[selenium-webdriver]]></category>
            <category><![CDATA[bdd]]></category>
            <dc:creator><![CDATA[Cemal Yaver]]></dc:creator>
            <pubDate>Sat, 20 Jun 2020 10:15:37 GMT</pubDate>
            <atom:updated>2020-06-21T12:08:00.454Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, I will show you how to use cucumber with Selenium Webdriver.</p><figure><img alt="selenium cucumber bdd" src="https://cdn-images-1.medium.com/max/389/1*TkAB50MOKlN1sl1HdyLLDA.jpeg" /></figure><p><strong>What is cucumber first?</strong><br>Let’s start with this question. <strong>Behavior-Driven Development</strong> is a supported testing tool. A language called Gherkin is used. The biggest plus of this language is that it is written using a daily language so that it can be easily understood by everyone.</p><p><strong>What is gherkin language?<br></strong>Gherkin is a structure used when writing test cases with Cucumber. In our projects, a Gherkin file with .feature extension is created for each behavior. In this feature file, the behavior of the related feature in different situations is defined. With the keyword Given, the prerequisite, that is, the initial state, is defined, with the When keyword, the event is also defined with the Then keyword. Scenario is created with the steps of Given-When-Then.</p><p><strong>Given:</strong> Defines the initial state of the system. It allows the system to go to a defined state.<br><strong>When:</strong> Used to describe an event or action. An action to be taken is written after this keyword.<br><strong>Then: </strong>It is used to describe an expected result or situation.</p><p>Click to get more information<br><a href="https://cucumber.io/docs/cucumber/api/">https://cucumber.io/docs/cucumber/api/</a></p><p>Let’s try to login on twitter.</p><figure><img alt="Cucumber" src="https://cdn-images-1.medium.com/max/337/1*q-BXafAi3w-uAHR1RPgqCg.png" /></figure><p>We create the <strong>BasePage</strong> class under the base folder.</p><pre>public class BasePage {<br><br>    public static WebDriver <em>driver</em>;<br>    public static WebElement <em>element </em>= null;<br>    public static String <em>loginPageUrl </em>= &quot;https://twitter.com/login&quot;;<br>    <br>    public static void setup() {<br>        <em>driver </em>= new ChromeDriver();<br>        System.<em>out</em>.println(&quot;Opening browser&quot;);<br>        <em>driver</em>.manage().window().maximize();<br>        <em>driver</em>.manage().timeouts().implicitlyWait(10, TimeUnit.<em>SECONDS</em>);<br>    }<br>}</pre><p>We create <strong>Login.feature</strong> under features folder</p><pre>Feature: Login<br><br>  @Login<br>  Scenario: Correct Login<br>    Given Start driver and browser<br>    When Nagivate to url<br>    And Enter to Email<br>    And Enter to Password<br>    And Enter to SignIn</pre><p>We create the <strong>LoginPage</strong> class under the pages folder</p><pre>public class LoginPage extends BasePage {<br><br>    private static LoginPage <em>instance</em>;<br><br>    public static synchronized LoginPage getInstance() {<br>        if (<em>instance </em>== null)<br>            <em>instance </em>= new LoginPage();<br>        return <em>instance</em>;<br>    }<br><br>    public void startDriver() {<br>        BasePage.<em>setup</em>();<br>    }<br><br>    public void navigateToUrl() {<br>        <em>driver</em>.get(<em>loginPageUrl</em>);<br>    }<br><br>    public void enterEmail() {<br>        <em>element </em>= <em>driver</em>.findElement(By.<em>xpath</em>(&quot;//input[@name=&#39;session[username_or_email]&#39;]&quot;));<br>        <em>element</em>.sendKeys(&quot;cemal@gmail.com&quot;);<br>    }<br><br>    public void enterPassword() {<br>        <em>element </em>= <em>driver</em>.findElement(By.<em>xpath</em>(&quot;//input[@name=&#39;session[password]&#39;]&quot;));<br>        <em>element</em>.sendKeys(&quot;123456&quot;);<br>    }<br><br>    public void enterSignIn() {<br>        <em>element </em>= <em>driver</em>.findElement(By.<em>xpath</em>(&quot;//div[@data-testid=&#39;LoginForm_Login_Button&#39;]&quot;));<br>        <em>element</em>.click();<br>    }<br>}</pre><p>We create the <strong>Hooks</strong> and <strong>LoginPage</strong> Step class under the page Steps folder.</p><pre>public class Hooks extends BasePage {<br><br>    @After<br>    public void quit() {<br>        System.<em>out</em>.println(&quot;quit browser&quot;);<br>        <em>driver</em>.quit();<br>    }<br>}</pre><pre>public class LoginPageStep {<br><br>    private static LoginPage <em>loginPage </em>= LoginPage.<em>getInstance</em>();<br><br>    @Given(&quot;^Start driver and browser$&quot;)<br>    public void startDriver() {<br>        <em>loginPage</em>.startDriver();<br>    }<br><br>    @When(&quot;^Nagivate to url$&quot;)<br>    public void navigateToUrl() {<br>        <em>loginPage</em>.navigateToUrl();<br>    }<br><br>    @And(&quot;^Enter to Email$&quot;)<br>    public void enterEmail() {<br>        <em>loginPage</em>.enterEmail();<br>    }<br><br>    @And(&quot;^Enter to Password$&quot;)<br>    public void enterPassword() {<br>        <em>loginPage</em>.enterPassword();<br>    }<br><br>    @And(&quot;^Enter to SignIn$&quot;)<br>    public void enterSignIn() {<br>        <em>loginPage</em>.enterSignIn();<br>    }<br>}</pre><p>We create the <strong>TestRunner </strong>class under runner folder.</p><pre>@CucumberOptions(features = &quot;src\\test\\java\\Features&quot;, glue = {&quot;pageSteps&quot;})<br>public class TestRunner extends AbstractTestNGCucumberTests {<br>}</pre><figure><img alt="cucumber result" src="https://cdn-images-1.medium.com/max/1024/1*XZm5VeWykckgz42LQtLx5w.png" /></figure><p>You can find the full code on github<br><a href="https://github.com/yavercemal/SeleniumCucumber">https://github.com/yavercemal/SeleniumCucumber</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83ae64c6939d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Page Object Model with Page Factory]]></title>
            <link>https://medium.com/@cemalyaver/page-object-model-with-page-factory-46a3bc812fbd?source=rss-efaa159aa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/46a3bc812fbd</guid>
            <category><![CDATA[page-object-pattern]]></category>
            <category><![CDATA[pom]]></category>
            <category><![CDATA[page-object-model]]></category>
            <category><![CDATA[selenium-test-automation]]></category>
            <category><![CDATA[pagefactory]]></category>
            <dc:creator><![CDATA[Cemal Yaver]]></dc:creator>
            <pubDate>Sat, 04 Apr 2020 13:32:12 GMT</pubDate>
            <atom:updated>2020-04-05T14:24:42.452Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, I’m going to talk about Page Factory model using Selenium Webdriver. So we will search on google.</p><figure><img alt="page object model, page factory,page factory model,page factory design" src="https://cdn-images-1.medium.com/max/1024/1*eem-OUzSkq7XrjqmTuXP8g.jpeg" /></figure><p>PageFactory is a concept of Page object model that enables creating object storage, sustainable, reusable and managing elements from one place. It is used to initialize elements of a Page class without having to use ‘FindElement’ or ‘FindElements’. Annotations can be used to supply descriptive names of target objects to improve code readability.The PageFactory model detects Web elements with @FindBy annotation.</p><p>Let’s start now.</p><p>Pom.xml</p><pre>&lt;dependencies&gt;<br><br>    &lt;!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java --&gt;<br>    &lt;dependency&gt;<br>        &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;<br>        &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;<br>        &lt;version&gt;3.141.59&lt;/version&gt;<br>    &lt;/dependency&gt;<br><br>    &lt;!-- https://mvnrepository.com/artifact/org.testng/testng --&gt;<br>    &lt;dependency&gt;<br>        &lt;groupId&gt;org.testng&lt;/groupId&gt;<br>        &lt;artifactId&gt;testng&lt;/artifactId&gt;<br>        &lt;version&gt;7.0.0&lt;/version&gt;<br>        &lt;scope&gt;test&lt;/scope&gt;<br>    &lt;/dependency&gt;<br>    <br>&lt;/dependencies&gt;</pre><p><strong>BasePage </strong>-&gt;first we create a folder named base. Then we create the Base Page class inside the base folder.</p><pre>public class BasePage {<br><br>    public String baseUrl = &quot;https://www.google.com/&quot;;<br>    public WebDriver driver;<br><br>    @BeforeTest<br>    public  void setBaseUrl() {<br>        driver = new ChromeDriver();<br>        driver.get(baseUrl);<br>    }<br><br>    @AfterTest<br>    public void endSession() {<br>        driver.quit();<br>    }</pre><p><strong>HomePage</strong> -&gt;first we create a folder named pages. Then we create the HomePage class inside the pages folder.</p><pre>public class HomePage {<br><br>    WebDriver _driver;<br><br>    public HomePage(WebDriver driver) {<br>        this._driver=driver;<br>        PageFactory.<em>initElements</em>(_driver, this);<br>    }<br><br>    @FindBy(name = &quot;q&quot;)<br>    private WebElement searchGoogle;<br><br>    @FindBy(xpath = &quot;//div[@class=&#39;FPdoLc tfB0Bf&#39;]//input[@name=&#39;btnK&#39;]&quot;)<br>    private WebElement searchClick;<br><br>    public void setGoogleTextbox(String searchTextbox) {<br>        searchGoogle.sendKeys(searchTextbox);<br>    }<br><br>    public void searchClick() {<br>        searchClick.click();<br>    }<br>}</pre><p>This class is important because we create the page factory here.We started a page factory with constructive method. You might think that. How can I do without using the Page factory model?There is a difference in readability.The following structure was made without using the page object model. For now, you might not see much difference. But you can see the benefit as the codes increase.</p><pre>public class HomePage {<br><br>    private static WebElement <em>element </em>= null;<br><br>    public static void setGoogleTextbox(WebDriver driver,String searchTextbox) {<br>        <em>element </em>= driver.findElement(By.<em>name</em>(&quot;q&quot;));<br>        <em>element</em>.sendKeys(searchTextbox);<br>    }<br><br>    public static void searchClick(WebDriver driver) {<br>        <em>element </em>= driver.findElement(By.<em>xpath</em>(&quot;//div[@class=&#39;FPdoLc tfB0Bf&#39;]//input[@name=&#39;btnK&#39;]&quot;));<br>        <em>element</em>.click();<br>    }<br>}</pre><p><strong>HomePageTest</strong> -&gt;first we create a folder named tests. Then we create the HomePageTest class inside the tests folder. We write the operations we do in this class.</p><pre>public class HomePageTest extends BasePage {<br><br>    @Test<br>    public void searchGoogle() {<br>        HomePage homePage = new HomePage(driver);<br>        homePage.setGoogleTextbox(&quot;Test Automation&quot;);<br>        homePage.searchClick();<br>    }<br>}</pre><p>You can find the full code on github : <a href="https://github.com/yavercemal/PageFactory">https://github.com/yavercemal/PageFactory</a></p><p>Then run the HomePageTest class.</p><figure><img alt="page factory, page factory model, page factory design, page object model" src="https://cdn-images-1.medium.com/max/813/1*wzCcUJOljME_rKuFaXrcnQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46a3bc812fbd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>