Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Driver . Class is not working on Firefox browser page not finding any Element and driver.getTitle() #999

Closed
Fatimi opened this issue Oct 5, 2017 · 4 comments

Comments

@Fatimi
Copy link

Fatimi commented Oct 5, 2017

System

  • Version: 19.0
  • Platform:Windows 7
  • Firefox: 56.0 (64 bit)
  • Selenium: 3.6.0

Testcase

I want to get title of my webpage but unbale to print it as browser not reading any .driver class

package auto_Procurement;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class procurement_auto {

public static void main(String[] args) throws IOException {
	System.setProperty("webdriver.gecko.driver", "C:/Users/aamir.fatimi/Downloads/geckodriver-v0.19.0-win64/geckodriver.exe");

	WebDriver driver = new FirefoxDriver();
	driver.get("http://dbu-export-09/en/Pages/default.aspx");
	Runtime.getRuntime().exec("C:\\Users\\aamir.fatimi\\Desktop\\AutoIT\\Autoit.exe");
	driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
	String get_Title = driver.getTitle();
	
	//WebElement eservices1 = driver.findElement(By.linkText("E-SERVICES"));
	//eservices1.click();
	System.out.println("Title is" + get_Title);
	driver.quit();
}

}

Stacktrace

1507199865260 geckodriver INFO geckodriver 0.19.0
1507199865268 geckodriver INFO Listening on 127.0.0.1:23773
1507199865989 mozrunner::runner INFO Running command: "C:\Program Files\Mozilla Firefox\firefox.exe" "-marionette" "-profile" "C:\Users\AAMIR~1.FAT\AppData\Local\Temp\rust_mozprofile.W8diIkeLeheg"
1507199866317 addons.xpi WARN Error parsing extensions state: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [amIAddonManagerStartup.readStartupData]" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: resource://gre/modules/addons/XPIProvider.jsm :: loadExtensionState :: line 1554" data: no] Stack trace: loadExtensionState()@resource://gre/modules/addons/XPIProvider.jsm:1554 < getInstallState()@resource://gre/modules/addons/XPIProvider.jsm:1589 < checkForChanges()@resource://gre/modules/addons/XPIProvider.jsm:3109 < startup()@resource://gre/modules/addons/XPIProvider.jsm:2188 < callProvider()@resource://gre/modules/AddonManager.jsm:269 < _startProvider()@resource://gre/modules/AddonManager.jsm:739 < startup()@resource://gre/modules/AddonManager.jsm:906 < startup()@resource://gre/modules/AddonManager.jsm:3090 < observe()@jar:file:///C:/Program%20Files/Mozilla%20Firefox/omni.ja!/components/addonManager.js:65
1507199867297 Marionette INFO Enabled via --marionette
Unable to read VR Path Registry from C:\Users\aamir.fatimi\AppData\Local\openvr\openvrpaths.vrpath
[Child 30472] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 30472] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
1507199870595 Marionette INFO Listening on port 51760
1507199870722 Marionette WARN TLS certificate errors will be ignored for this session
1507199870786 Marionette DEBUG Register listener.js for window 4294967297
Oct 05, 2017 3:37:50 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
1507199870905 Marionette DEBUG Received DOM event "beforeunload" for "about:blank"
Exception in thread "main" org.openqa.selenium.UnhandledAlertException: :
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T16:15:40.131Z'
System info: host: 'KHILT-1573', ip: '192.168.142.193', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\aamir.fatimi\AppData\Local\Temp\rust_mozprofile.W8diIkeLeheg, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal, moz:headless=false, platform=XP, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=56.0, platformVersion=6.1, moz:processID=30932, browserName=firefox, javascriptEnabled=true, platformName=XP}]
Session ID: 0db44e36-7403-4dc2-bc6d-533f856d57cb
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:118)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:643)
at org.openqa.selenium.remote.RemoteWebDriver.getTitle(RemoteWebDriver.java:314)
at auto_Procurement.procurement_auto.main(procurement_auto.java:22)

@andreastt
Copy link
Contributor

You’re running into an UnhandledAlertException which you don’t handle. You need to dismiss the alert before you can get the title or find elements.

@Fatimi
Copy link
Author

Fatimi commented Oct 5, 2017

@andreastt
I am new to selenium , can you please help here how to dismiss the alert ?

@whimboo
Copy link
Collaborator

whimboo commented Oct 10, 2017

What is the HTTP response when opening "http://dbu-export-09/en/Pages/default.aspx"? I assume it opens a save as dialog for a custom MIME type? Using AutoIT here is not the best idea, because if that fails, you won't really be able to recover from that during teardown.

I would suggest that you use a httplib library and check the returned MIME type and file size. That MIME type you should whitelist in Firefox so that the save as dialog doesn't get opened.

@lock
Copy link

lock bot commented Aug 17, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have run into an issue you think is related, please open a new issue.

@lock lock bot locked and limited conversation to collaborators Aug 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants