Sunday, 21 September 2014

Selenium step by step 1

I got many issues:



  
Error 1:
my eclipse always has this error:
Description Resource Path Location Type Archive for required library: '/Users/Peter/.m2/repository/org/seleniumhq/selenium/selenium-java/2.42.2/selenium-java-2.42.2.jar' in project 'seleniumtest' cannot be read or is not a valid ZIP file seleniumtest Build path Build Path Problem
  
Solution 1:
mvn eclipse:eclipse
  
Error2:
maven build failed because selenium-java-2.42.2.jar and other 3 jar files have below issue:
invalid CEN header (bad signature)
  
Solution 2:
delete them in my maven repository, for example
cd /Users/Peter/.m2/repository/org/seleniumhq/selenium/selenium-safari-driver/2.42.2/
rm *.jar
  
Error3:
run java code in eclipse, that can launch firefox for me, but it is still not able to access the url i specified.
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd} 1411310417833 addons.xpi INFO Mapping fxdriver@googlecode.com to /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/fxdriver@googlecode.com 1411310417833 addons.xpi DEBUG Ignoring file entry whose name is not a valid add-on ID: /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/webdriver-staging 1411310417833 addons.xpi DEBUG checkForChanges 1411310417837 addons.xpi DEBUG Directory state JSON differs: cache [] state [{"name":"app-global","addons":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"descriptor":"/Applications/Firefox.app/Contents/MacOS/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}","mtime":1411080857000,"rdfTime":1411080851000}}},{"name":"app-profile","addons":{"fxdriver@googlecode.com":{"descriptor":"/var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/fxdriver@googlecode.com","mtime":1411310417000,"rdfTime":1411310417000}}}] 1411310417841 addons.xpi-utils DEBUG Opening XPI database /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions.json 1411310417842 addons.xpi DEBUG New add-on fxdriver@googlecode.com installed in app-profile *** Blocklist::_loadBlocklistFromFile: blocklist is disabled 1411310417855 addons.xpi-utils DEBUG Make addon app-profile:fxdriver@googlecode.com visible 1411310417856 DeferredSave.extensions.json DEBUG Save changes 1411310417857 DeferredSave.extensions.json DEBUG Save changes 1411310417857 addons.xpi DEBUG New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global 1411310417858 addons.xpi-utils DEBUG Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible 1411310417858 DeferredSave.extensions.json DEBUG Save changes 1411310417858 DeferredSave.extensions.json DEBUG Save changes 1411310417861 addons.xpi DEBUG Updating database with changes to installed add-ons 1411310417861 addons.xpi-utils DEBUG Updating add-on states 1411310417861 addons.xpi-utils DEBUG Writing add-ons list 1411310418223 DeferredSave.extensions.json DEBUG Starting timer 1411310418250 addons.manager DEBUG shutdown 1411310418252 DeferredSave.extensions.json DEBUG Starting write 1411310418252 addons.xpi DEBUG shutdown 1411310418252 addons.xpi-utils DEBUG shutdown 1411310418283 DeferredSave.extensions.json DEBUG Write succeeded 1411310418284 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 16 1411310418284 addons.xpi DEBUG Notifying XPI shutdown observers 1411310418286 addons.manager DEBUG Async provider shutdown done 1411310418716 addons.manager DEBUG Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"] 1411310418717 addons.manager DEBUG Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"] 1411310418719 addons.xpi DEBUG startup 1411310418719 addons.xpi DEBUG Skipping unavailable install location app-system-share 1411310418720 addons.xpi INFO Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to /Applications/Firefox.app/Contents/MacOS/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd} 1411310418720 addons.xpi INFO Mapping fxdriver@googlecode.com to /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/fxdriver@googlecode.com 1411310418720 addons.xpi DEBUG Ignoring file entry whose name is not a valid add-on ID: /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/webdriver-staging 1411310418721 addons.xpi DEBUG checkForChanges 1411310418724 addons.xpi DEBUG No changes found *** Blocklist::_preloadBlocklistFile: blocklist is disabled JavaScript error: chrome://browser/content/urlbarBindings.xml, line 677: aUrl is undefined JavaScript error: chrome://browser/content/urlbarBindings.xml, line 677: aUrl is undefined JavaScript error: chrome://browser/content/urlbarBindings.xml, line 677: aUrl is undefined at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118) at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:114) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:191) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:186) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:182) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:95) at ExampleForFireFox.main(ExampleForFireFox.java:7) Exception in thread "main" org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/Applications/Firefox.app/Contents/MacOS/firefox-bin) on port 7055; process output follows: extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd} 1411310417833 addons.xpi INFO Mapping fxdriver@googlecode.com to /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/fxdriver@googlecode.com 1411310417833 addons.xpi DEBUG Ignoring file entry whose name is not a valid add-on ID: /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/webdriver-staging 1411310417833 addons.xpi DEBUG checkForChanges 1411310417837 addons.xpi DEBUG Directory state JSON differs: cache [] state [{"name":"app-global","addons":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"descriptor":"/Applications/Firefox.app/Contents/MacOS/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}","mtime":1411080857000,"rdfTime":1411080851000}}},{"name":"app-profile","addons":{"fxdriver@googlecode.com":{"descriptor":"/var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/fxdriver@googlecode.com","mtime":1411310417000,"rdfTime":1411310417000}}}] 1411310417841 addons.xpi-utils DEBUG Opening XPI database /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions.json 1411310417842 addons.xpi DEBUG New add-on fxdriver@googlecode.com installed in app-profile *** Blocklist::_loadBlocklistFromFile: blocklist is disabled 1411310417855 addons.xpi-utils DEBUG Make addon app-profile:fxdriver@googlecode.com visible 1411310417856 DeferredSave.extensions.json DEBUG Save changes 1411310417857 DeferredSave.extensions.json DEBUG Save changes 1411310417857 addons.xpi DEBUG New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global 1411310417858 addons.xpi-utils DEBUG Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible 1411310417858 DeferredSave.extensions.json DEBUG Save changes 1411310417858 DeferredSave.extensions.json DEBUG Save changes 1411310417861 addons.xpi DEBUG Updating database with changes to installed add-ons 1411310417861 addons.xpi-utils DEBUG Updating add-on states 1411310417861 addons.xpi-utils DEBUG Writing add-ons list 1411310418223 DeferredSave.extensions.json DEBUG Starting timer 1411310418250 addons.manager DEBUG shutdown 1411310418252 DeferredSave.extensions.json DEBUG Starting write 1411310418252 addons.xpi DEBUG shutdown 1411310418252 addons.xpi-utils DEBUG shutdown 1411310418283 DeferredSave.extensions.json DEBUG Write succeeded 1411310418284 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 16 1411310418284 addons.xpi DEBUG Notifying XPI shutdown observers 1411310418286 addons.manager DEBUG Async provider shutdown done 1411310418716 addons.manager DEBUG Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"] 1411310418717 addons.manager DEBUG Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"] 1411310418719 addons.xpi DEBUG startup 1411310418719 addons.xpi DEBUG Skipping unavailable install location app-system-share 1411310418720 addons.xpi INFO Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to /Applications/Firefox.app/Contents/MacOS/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd} 1411310418720 addons.xpi INFO Mapping fxdriver@googlecode.com to /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/fxdriver@googlecode.com 1411310418720 addons.xpi DEBUG Ignoring file entry whose name is not a valid add-on ID: /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/webdriver-staging 1411310418721 addons.xpi DEBUG checkForChanges 1411310418724 addons.xpi DEBUG No changes found *** Blocklist::_preloadBlocklistFile: blocklist is disabled JavaScript error: chrome://browser/content/urlbarBindings.xml, line 677: aUrl is undefined JavaScript error: chrome://browser/content/urlbarBindings.xml, line 677: aUrl is undefined JavaScript error: chrome://browser/content/urlbarBindings.xml, line 677: aUrl is undefined Build info: version: '2.42.2', revision: '6a6995d31c7c56c340d6f45a76976d43506cd6cc', time: '2014-06-03 10:52:47' System info: host: 'WangmatoMacBook-Pro.local', ip: '10.242.217.49', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.4', java.version: '1.7.0_06' Driver info: driver.version: FirefoxDriver at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:130) at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:114) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:191) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:186) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:182) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:95) at ExampleForFireFox.main(ExampleForFireFox.java:7) Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd} 1411310417833 addons.xpi INFO Mapping fxdriver@googlecode.com to /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/fxdriver@googlecode.com 1411310417833 addons.xpi DEBUG Ignoring file entry whose name is not a valid add-on ID: /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/webdriver-staging 1411310417833 addons.xpi DEBUG checkForChanges 1411310417837 addons.xpi DEBUG Directory state JSON differs: cache [] state [{"name":"app-global","addons":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"descriptor":"/Applications/Firefox.app/Contents/MacOS/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}","mtime":1411080857000,"rdfTime":1411080851000}}},{"name":"app-profile","addons":{"fxdriver@googlecode.com":{"descriptor":"/var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/fxdriver@googlecode.com","mtime":1411310417000,"rdfTime":1411310417000}}}] 1411310417841 addons.xpi-utils DEBUG Opening XPI database /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions.json 1411310417842 addons.xpi DEBUG New add-on fxdriver@googlecode.com installed in app-profile *** Blocklist::_loadBlocklistFromFile: blocklist is disabled 1411310417855 addons.xpi-utils DEBUG Make addon app-profile:fxdriver@googlecode.com visible 1411310417856 DeferredSave.extensions.json DEBUG Save changes 1411310417857 DeferredSave.extensions.json DEBUG Save changes 1411310417857 addons.xpi DEBUG New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global 1411310417858 addons.xpi-utils DEBUG Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible 1411310417858 DeferredSave.extensions.json DEBUG Save changes 1411310417858 DeferredSave.extensions.json DEBUG Save changes 1411310417861 addons.xpi DEBUG Updating database with changes to installed add-ons 1411310417861 addons.xpi-utils DEBUG Updating add-on states 1411310417861 addons.xpi-utils DEBUG Writing add-ons list 1411310418223 DeferredSave.extensions.json DEBUG Starting timer 1411310418250 addons.manager DEBUG shutdown 1411310418252 DeferredSave.extensions.json DEBUG Starting write 1411310418252 addons.xpi DEBUG shutdown 1411310418252 addons.xpi-utils DEBUG shutdown 1411310418283 DeferredSave.extensions.json DEBUG Write succeeded 1411310418284 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 16 1411310418284 addons.xpi DEBUG Notifying XPI shutdown observers 1411310418286 addons.manager DEBUG Async provider shutdown done 1411310418716 addons.manager DEBUG Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"] 1411310418717 addons.manager DEBUG Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"] 1411310418719 addons.xpi DEBUG startup 1411310418719 addons.xpi DEBUG Skipping unavailable install location app-system-share 1411310418720 addons.xpi INFO Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to /Applications/Firefox.app/Contents/MacOS/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd} 1411310418720 addons.xpi INFO Mapping fxdriver@googlecode.com to /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/fxdriver@googlecode.com 1411310418720 addons.xpi DEBUG Ignoring file entry whose name is not a valid add-on ID: /var/folders/zn/__jxsqc15_v5pt3yv_3_y4xm0000gn/T/anonymous3444901866624216425webdriver-profile/extensions/webdriver-staging 1411310418721 addons.xpi DEBUG checkForChanges 1411310418724 addons.xpi DEBUG No changes found *** Blocklist::_preloadBlocklistFile: blocklist is disabled JavaScript error: chrome://browser/content/urlbarBindings.xml, line 677: aUrl is undefined JavaScript error: chrome://browser/content/urlbarBindings.xml, line 677: aUrl is undefined JavaScript error: chrome://browser/content/urlbarBindings.xml, line 677: aUrl is undefined at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118) ... 7 more
  
solution for that is :

No comments:

Post a comment