<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Manoj Kumar</title>
    <description>The latest articles on Forem by Manoj Kumar (@manoj9788).</description>
    <link>https://forem.com/manoj9788</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F354235%2F23a0f0e0-e08b-49f8-ae62-81bdc343124a.jpeg</url>
      <title>Forem: Manoj Kumar</title>
      <link>https://forem.com/manoj9788</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/manoj9788"/>
    <language>en</language>
    <item>
      <title>Observability and Selenium</title>
      <dc:creator>Manoj Kumar</dc:creator>
      <pubDate>Thu, 18 Jun 2020 19:21:01 +0000</pubDate>
      <link>https://forem.com/manoj9788/observability-and-selenium-adg</link>
      <guid>https://forem.com/manoj9788/observability-and-selenium-adg</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/manoj9788/tracing-selenium-grid"&gt;Observability And Selenium&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Observability
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;It is a measure of how well internal states of a system can be inferred from knowledge of its external outputs. It helps bring visibility into systems.&lt;/em&gt; – Wikipedia &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Tracing is one of the important pillars for measuring observability along with logs and metrics. Its a way of thinking about the system, a way of being able to ask the system questions, that you need the answer to when you didn't know the questions beforehand. On the other hand, alerting is a way of asking questions when you do know the question beforehand.&lt;/p&gt;

&lt;p&gt;Distributed Tracing can be quite helpful in answering questions for your distributed system like,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Root cause analysis&lt;/li&gt;
&lt;li&gt;Performance optimisation&lt;/li&gt;
&lt;li&gt;dependency analysis of services&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Selenium-4
&lt;/h2&gt;

&lt;p&gt;It has a number of new exciting features and one such is a cleaner code for Selenium Grid along with support for distributed tracing via OpenTelemetry APIs. This is a pretty exciting and important feature for the admins and DevOps engineers to trace the flow of control through the Grid for each and every command.&lt;/p&gt;

&lt;p&gt;Distributed tracing has two parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Code instrumentation: Adding instrumentation code in your application to produce traces. The major instrumentation parts are done neatly by the developers of the Selenium project, which leaves us to consume it by using Selenium Grid start-up command along with Jaeger.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Collection of data and providing meaning over it, Jaeger has a UI which allows us to view traces visually well.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Steps to start tracing your tests,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Start Jaeger via docker(as it's easy)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Instrument your Selenium Grid start-up command with Jaeger tracing as in &lt;a href="https://github.com/manoj9788/tracing-selenium-grid/blob/master/start-grid-distributed.sh"&gt;start-grid-distributed.sh&lt;/a&gt; and &lt;a href="https://github.com/manoj9788/tracing-selenium-grid/blob/master/start-grid-standalone.sh"&gt;start-grid-standalone.sh&lt;/a&gt; for standalone mode.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now execute your tests, and navigate to &lt;code&gt;http://localhost:16686/&lt;/code&gt; to view the outputs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;p&gt;Assuming you have docker running on your machine,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install Coursier via homebrew &lt;code&gt;brew install coursier/formulas/coursier&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Install &lt;a href="https://www.jaegertracing.io/download/"&gt;Jaeger&lt;/a&gt; via docker&lt;/li&gt;
&lt;li&gt;Selenium-server.jar refers to the latest alpha version of selenium releases (Tested with Alpha 5)&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Start Jaeger via docker server
&lt;/h2&gt;

&lt;p&gt;The simplest way to start the all-in-one is to use the pre-built image published to DockerHub (a single command line).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ docker run --rm -it --name jaeger \
    -p 16686:16686 \
    -p 14250:14250 \
    jaegertracing/all-in-one:1.17
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can then navigate to &lt;a href="http://localhost:16686"&gt;http://localhost:16686&lt;/a&gt; to access the Jaeger UI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Instrument your Selenium Grid command
&lt;/h2&gt;

&lt;p&gt;We're going to add support for Open Telemetry API's(one of the many ways to do distributed tracing) using &lt;a href="https://get-coursier.io/docs/overview"&gt;Coursier&lt;/a&gt; to generate a full classpath when started this way the selenium server will inform you that it has found a tracer on stdout.&lt;/p&gt;

&lt;p&gt;Refer &lt;a href="https://github.com/manoj9788/tracing-selenium-grid/blob/master/start-grid-distributed.sh"&gt;start-grid-distributed.sh&lt;/a&gt; if you want to start Grid in distributed mode.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl http://localhost:4444/status&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 to check if your grid deployment is ready&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---4ISBlbS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/manoj9788/tracing-selenium-grid/master/images/grid-ready.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---4ISBlbS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/manoj9788/tracing-selenium-grid/master/images/grid-ready.png" alt="Grid status"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Execute your tests
&lt;/h2&gt;

&lt;p&gt;Point your tests as in &lt;a href="https://github.com/manoj9788/tracing-selenium-grid/blob/master/src/test/java/com/thoughtworks/tracing/DistributedTracingExamples.java"&gt;DistributedTracingExamples&lt;/a&gt; Class and navigate to &lt;a href="http://localhost:16686/"&gt;http://localhost:16686/&lt;/a&gt; to view the outputs.&lt;/p&gt;

&lt;p&gt;Under services lookup for Selenium-router and notices actions for each call made by your tests. An example below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---n9gx-sR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/manoj9788/tracing-selenium-grid/master/images/route-traces.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---n9gx-sR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/manoj9788/tracing-selenium-grid/master/images/route-traces.png" alt="Traces"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/SeleniumHQ/selenium/"&gt;Tracing Info command&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.jaegertracing.io/docs/1.17/getting-started/"&gt;Jaeger guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learning.oreilly.com/library/view/distributed-systems-observability/9781492033431/ch04.html"&gt;Three Pillars of Observability&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A special thanks to ever-helpful Simon Stewart&lt;/p&gt;

&lt;p&gt;Thanks, folks!&lt;br&gt;
&lt;a href="https://twitter.com/manoj9788"&gt;Follow me on Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>testing</category>
      <category>devops</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Getting Started with GraphQL</title>
      <dc:creator>Manoj Kumar</dc:creator>
      <pubDate>Thu, 11 Jun 2020 15:33:57 +0000</pubDate>
      <link>https://forem.com/manoj9788/getting-started-with-graphql-23k8</link>
      <guid>https://forem.com/manoj9788/getting-started-with-graphql-23k8</guid>
      <description>&lt;h2&gt;
  
  
  What is GraphQL?
&lt;/h2&gt;

&lt;p&gt;GraphQL is an API specification standard and an Open-Source data query and manipulation language. It has a server-side runtime fulfilling those queries along with the data. In other words, GraphQL follows WYAIWYG pattern What You Ask Is What You Get. GraphQL allows declarative data fetching where a client can specify what data it needs from an API.&lt;/p&gt;

&lt;p&gt;Facebook invented GraphQL, and now it is maintained by a large community of companies and individuals all over the world. GraphQL is a specification and, users shall create their implementation on different platforms conforming to the specification. Therefore, Netflix Open-Sourced their implementation called Falcor. An easy example for folks coming from Test Automation world, it is like WebDriver being a W3C Specification, Selenium and WebDriverIO are its browser automation implementation.&lt;/p&gt;

&lt;p&gt;GraphQL has two parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Server component, a GraphQL server to accept the incoming requests and send back data precisely.&lt;/li&gt;
&lt;li&gt;A Client component, to send a POST request (with payload) to the GraphQL server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GraphQL uses a type system to define the capabilities of an API. All the types declared in an API are written in a schema using the GraphQL Schema. Namely, Schema Definition Language (SDL). It serves as a contract between the client and the server to define how a client can access the data. Defining the Schema allows the back-end and front-end teams to concentrate on their piece of work without much communication.&lt;/p&gt;

&lt;p&gt;More content here: &lt;a href="https://blog.testproject.io/2020/06/11/introduction-and-getting-started-with-graphql/"&gt;https://blog.testproject.io/2020/06/11/introduction-and-getting-started-with-graphql/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>graphql</category>
      <category>testing</category>
      <category>automation</category>
      <category>gettingstarted</category>
    </item>
    <item>
      <title>What's new in Selenium 4?</title>
      <dc:creator>Manoj Kumar</dc:creator>
      <pubDate>Thu, 11 Jun 2020 15:28:13 +0000</pubDate>
      <link>https://forem.com/manoj9788/what-s-new-in-selenium-4-43p7</link>
      <guid>https://forem.com/manoj9788/what-s-new-in-selenium-4-43p7</guid>
      <description>&lt;p&gt;A cross-post of Selenium 4 article.&lt;/p&gt;

&lt;p&gt;A lot of developments have happened since Selenium 4 was announced during the State of the Union Keynote by Simon Stewart and Manoj Kumar. There has been a significant amount of work done and we’ve released at least six alpha versions of Selenium 4 for users to try out and report back with any potential bugs so that we can make it right.&lt;/p&gt;

&lt;h2&gt;
  
  
  Selenium WebDriver
&lt;/h2&gt;

&lt;p&gt;One of the main reasons to release WebDriver as a major version (Selenium 4) is because of the complete W3C protocol adoption. The W3C protocol dialect has been available since the 3.8 version of Selenium WebDriver along with the JSON wire protocol. This change in protocol isn’t going to impact the users in any way, as all major browser drivers (such as geckodriver and chromedriver), and many third party projects, have already fully adopted the W3C protocol.&lt;/p&gt;

&lt;p&gt;However, there are some notable new APIs, as well as the removal of deprecated APIs in the WebDriver API, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Elements:

&lt;ul&gt;
&lt;li&gt;The FindsBy* interfaces (e.g. FindsByID, FindsByCss …) have been deleted. The recommended alternative is to use a &lt;code&gt;By&lt;/code&gt; instance passed to &lt;code&gt;findElements&lt;/code&gt; instead.&lt;/li&gt;
&lt;li&gt;“Relative locators”: a friendly way of locating elements using terms that users use, like “near”, “left of”, “right of”, “above” and “below”. This was inspired by an automation tool called Sahi by Narayan Raman, and the approach has also been adopted by tools like Taiko by ThoughtWorks.&lt;/li&gt;
&lt;li&gt;A richer set of exceptions, providing better information about why a test might have failed. These include exceptions like ElementClickInterceptedError, NoSuchCookieError &amp;amp; more.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Chrome Debugging Protocol (CDP):
Although Selenium works on every browser, for those browsers that support it, Selenium 4 offers CDP integration, which allows us to take advantage of the enhanced visibility into the browser that a debugging protocol gives.
Because the CDP is, as the name suggests, designed for debuggers, it’s not the most user friendly of APIs. Fortunately, the Selenium team is working to provide comfortable cross-language APIs to cover common requirements, such as network stubbing, capturing logs, mocking geolocation, and more.&lt;/li&gt;
&lt;li&gt;Browser Specifics:
A new ChromiumDriver extends packages for both Chrome and Edge browsers.
A new method to allow install and uninstall add-ons for Firefox browser at runtime.&lt;/li&gt;
&lt;li&gt;Window Handling:
Users can go in full-screen mode during script executions.
Better control of whether new windows open as tabs, or in their own window.&lt;/li&gt;
&lt;li&gt;Screenshots:
An option to grab a screenshot at UI element level. Unlike the usual view-port level screenshot.
Full Page Screenshot support for Firefox browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What’s next in WebDriver beyond Selenium 4?
&lt;/h3&gt;

&lt;p&gt;It would be nice to have users extend the locator strategy like FindByImage or FindbyAI (like in Appium) – right now we have a hardcoded list of element location strategies. Providing a lightweight way of extending this set, particularly when using Selenium Grid, is on the roadmap.&lt;/p&gt;

&lt;p&gt;There are a lot of other features added to Selenium IDE and Selenium Grid. Please refer &lt;a href="https://applitools.com/blog/selenium-4/"&gt;https://applitools.com/blog/selenium-4/&lt;/a&gt; for more content&lt;/p&gt;

</description>
      <category>testing</category>
      <category>automation</category>
      <category>selenium</category>
      <category>browser</category>
    </item>
  </channel>
</rss>
