TESTEVERYTHING

Showing posts with label Automation Tips. Show all posts
Showing posts with label Automation Tips. Show all posts

Thursday, 13 July 2017

Handle custom tags using WebDriver

Sometime while doing automation we have to identify the element which have custom tags like <g> <svg> etc. For this we normally use * that will identify all elements tags in case we have to identify only specified custom tag then we can use below example for this.


<svg height="600" width="910" xmlns:xlink="http://www.w3.org/1999/xlink"  
   id="svgcontent" overflow="visible" x="910" y="600" viewBox="0 0 910 600">
    <g style="pointer-events:all">
      <text fill="rgb(0,0,0)" font-family="Sans-Serif" font-size="13" id="80-155-126" 
        transform="rotate(-90, 168, 126)" y="126" x="168" style="pointer-
         events:inherit">A100A</text>
   </g>
  </svg>

Following Xpath will work here

By.xpath("//*[local-name()='svg']")

By.xpath("//*[local-name()='text']")


By.xpath("//*[local-name()='g']")


Friday, 2 December 2011

Selenium disable add-ons pop-up for Custom firefox profile

Here is the way to disable add-ons window which appears every time when selenium scripts are run on Custom Firefox Profile.


Close all instances of Firefox browser and delete the following files from the Custom Profile folder, this should reset Extension Manager and disable add-ons pop-up:
  • extensions.cache
  • extensions.ini
  • extensions.rdf
  • compatibility.ini
This Add-ons pop-up will not displayed the next time you run selenium scripts.

To find the Firefox profile,  type in cmd run prompt "%APPDATA%\Mozilla\Firefox\Profiles\"  press enter

Which one is right ?

Translate







Tweet