Tuesday 21 March 2017

WebDriver: Frequent Issues and solutions in webdriver programs

ISSUE1:  Fix Java was Started but Returned Exit Code=13 in Eclipse

Solution:


  • Goto Eclipse and search for eclipse.ini file >> Right click >> open with note pad

  • Now put the following code in editor 

-vm C:/Program Files /Java/jdk1.7.0_21/bin/javaw.exe
***Highlighted are you need to replace with your JDK folder path from your C drive***

  • click on save >> try to open your eclipse  
ISSUE2:  launching Chrome browser for MAC OS  :


Procedure 1:
1)      Unzip the chrome executable file
2)      Copy the chromedriver and Open the Finder and click on Go it will open a dropdown menu. Click on Go to Folder.
3)      On Go To Folder windows pop up enter following path “/usr/local/bin”
4)      Paste chromedriver
5)      Restart machine
6)      Execute the program now

Procedure 2:
1          1)      Open the terminal >> echo $PATH>>and identified as a path >> /usr/Local/bin:
2          2)      We need to copy the chromedriver to the above folder hence
3          3)      Cd downloads
4          4)      Cp chromedriver / usr/Local/bin
5          5)      Cd /usr/Local/bin
6          6)      ls >> now run the script 

        

Solution  for MAC:
System.setProperty("webdriver.firefox.bin","/Applications/Firefox.app/Contents/MacOS/firefox-bin");
    WebDriver driver = new FirefoxDriver();

Solution  for Windows:
System.setProperty("webdriver.firefox.bin""C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); 
  WebDriver driver = new FirefoxDriver();

Issue 4: IE Browser launching: org.openqa.selenium.remote.SessionNotFoundException:Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones.

Solution: This is because of security setting in IE
>> Open IE , then go to Tools>>Security tab .

>>Now either check or uncheck the "Enable Protected Mode" checkbox for all zones i.e Internet , Local internet, Trusted Sites, Restricted Sites.


ISSUE 5:
  sendKeys“sendKeys(CharSequence[]) in the type WebElement is not applicable for the arguments (String)”

solution 1:

1.     Right click on your java project and select Build Path -> Click on Configure Build Path...
2.     In project properties window: Click/select Java Compiler at the left panel
3.     At the right panel: change the Compiler compliance level from 1.4 to 1.7 or higher

4.     Lastly Click on Apply and OK


solution 2:

1.     Right-click on project » Properties » Java Build Path
2.     Select Libraries tab
3.     Find the JRE System Library and remove it
4.     Click Add Library... button at right side » Add the JRE System Library (Workspace default JRE)

Reason: Sometimes while creating project compiler version will be below 1.5 version so Selenium method that is sendKeys will not able to read by compiler so we need to upgrade the compiler version to 1.5 and above.


    ISSUE 7:Stale Element Reference in Selenium Webdriver
Reason: 1 -The element has been deleted entirely.
Reason :2- The element is no longer attached to the DOM.
Solution 1: refresh the webpage and try to identify the object
Solution 2: try to perform click operation repetitively just keeping in a for loop




Updating few more issues... 

No comments:

Post a Comment