Publicidade - Adsense

Duvida automação com selenium Webdriver



  • Criei meu primeiro JUnit test case, ele teria de abrir o browser, navegar ate uma determinada pagina e então encontrar um elemento, porém ele abre o navegador na pagina inicial do Firefox permanece nela depois fecha e apresenta erro, segue abaixo o código e o erro apresentado:

    package testWebDriver;
    
    import static org.junit.Assert.*;
    import org.junit.After;
    import org.junit.Before;
    import org.junit.Test;
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.WebElement;
    
    
    public class EncontrarElementos {
    	
    	private WebDriver driver;
    	
    	@Before // Para acessar a pagina antes da execução do teste
    	public void setUp() 
    	{
    		
    		driver = new FirefoxDriver();
    		driver.get("http://chamados.cabtec.com.br:9088/Plataforma/");
    		driver.manage().window().maximize();
    	}
    	
    	@Test
    	public void encontrarElementos()
    	{
    		WebElement btnLogin = driver.findElement(By.id("btnLogin"));
    		assertTrue(btnLogin.getText().contains("Efetuar login"));
    		
    	}
    	
    	@Test
    	public void atualizarPagina()
    	{
    		driver.navigate().refresh();
    	}
    	
    	@After
    	public void fecharPagina()
    	{
    		driver.quit();
    	}
    
    }
    
    

    Segue erros:

    org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
    otstrap method startup on [email protected] version 1.0
    1470767348062	addons.xpi	DEBUG	Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
    1470767348063	addons.xpi	DEBUG	Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
    1470767348067	addons.xpi	DEBUG	Calling bootstrap method startup on [email protected] version 1.0.2
    1470767348074	addons.xpi-utils	DEBUG	Starting async load of XPI database C:\Users\Nayara\AppData\Local\Temp\anonymous7691597555823780172webdriver-profile\extensions.json
    1470767348075	addons.xpi	DEBUG	Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
    1470767348076	addons.xpi	DEBUG	Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
    1470767348082	addons.xpi	DEBUG	Calling bootstrap method startup on [email protected] version 1.3.2
    1470767348103	addons.manager	DEBUG	Registering shutdown blocker for XPIProvider
    1470767348104	addons.manager	DEBUG	Provider finished startup: XPIProvider
    1470767348104	addons.manager	DEBUG	Starting provider: LightweightThemeManager
    1470767348104	addons.manager	DEBUG	Registering shutdown blocker for LightweightThemeManager
    1470767348104	addons.manager	DEBUG	Provider finished startup: LightweightThemeManager
    1470767348104	addons.manager	DEBUG	Starting provider: GMPProvider
    1470767348110	addons.manager	DEBUG	Registering shutdown blocker for GMPProvider
    1470767348111	addons.manager	DEBUG	Provider finished startup: GMPProvider
    1470767348111	addons.manager	DEBUG	Starting provider: PluginProvider
        1470767348111	addons.manager	DEBUG	Registering shutdown blocker for PluginProvider
      
      1470767348111	addons.manager	DEBUG	Provider finished startup: PluginProvider
        1470767348112	addons.manager	DEBUG	Completed startup sequence
        1470767348383	addons.xpi-utils	DEBUG	Async JSON file read took 0 MS
        1470767348383	addons.xpi-utils	DEBUG	Finished async read of XPI database, parsing...
        1470767348385	addons.xpi-utils	DEBUG	Successfully read XPI database
        1470767348396	addons.manager	DEBUG	Starting provider: <unnamed-provider>
        1470767348396	addons.manager	DEBUG	Registering shutdown blocker for <unnamed-provider>
        1470767348396	addons.manager	DEBUG	Provider finished startup: <unnamed-provider>
        *** Blocklist::_loadBlocklistFromFile: blocklist is disabled
        1470767348513	addons.manager	DEBUG	Starting provider: PreviousExperimentProvider
        1470767348513	addons.manager	DEBUG	Registering shutdown blocker for PreviousExperimentProvider
        1470767348513	addons.manager	DEBUG	Provider finished startup:     PreviousExperimentProvider
        JavaScript warning: https://normandy.cdn.mozilla.net/static/bundles/selfrepair-    72948156b77d6ce320e0.1e946d807ad4.js, line 11001: mutating the [[Prototype]] of an     object will cause your code to run very slowly; instead create the object with the correct     initial [[Prototype]] value using Object.create
        1470767358535	addons.xpi	DEBUG	Calling bootstrap method shutdown on [email protected] version 1.0
        1470767358536	addons.xpi	DEBUG	Calling bootstrap method shutdown on [email protected] version 1.0.2
        1470767358537	addons.xpi	DEBUG	Calling bootstrap method shutdown on l[email protected] version 1.3.2
        1470767358818	addons.manager	DEBUG	shutdown
        1470767358819	addons.manager	DEBUG	Calling shutdown blocker for XPIProvider
        1470767358819	addons.xpi	DEBUG	shutdown
        1470767358819	addons.xpi-utils	DEBUG	shutdown
        1470767358820	addons.manager	DEBUG	Calling shutdown blocker for LightweightThemeManager
        1470767358820	addons.manager	DEBUG	Calling shutdown blocker for GMPProvider
        1470767358822	addons.manager	DEBUG	Calling shutdown blocker for PluginProvider
        1470767358823	addons.manager	DEBUG	Calling shutdown blocker for <unnamed- provider>
        1470767358824	addons.manager	DEBUG	Calling shutdown blocker for      
    PreviousExperimentProvider
        1470767358827	addons.xpi	DEBUG	Notifying XPI shutdown observers
        1470767358831	addons.manager	DEBUG	Async provider shutdown done
        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.<init>(RemoteWebDriver.java:114)
    	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
    	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
    	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
    	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
    	at testWebDriver.EncontrarElementos.setUp(EncontrarElementos.java:21)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    segue erros:
    


  • @nayavsantos Olá

    Geralmente esse erro acontece pelo selenium não suportar a versão do firefox que vc está usando.

    Passa ai as versões do selenium e firefox que vc está usando :)



  • @Leonardo-Galani

    selenium-2.44.0
    Firefox 47.0.1

    :)



  • pega a última versão do selenium para java estável :)
    http://selenium-release.storage.googleapis.com/index.html?path=2.53/



  • @Leonardo-Galani
    eu peguei, atualizei as bibliotecas, mas quando eu executo o codigo ele tenta acessar o seguinte endereço no firefox: ‘about:blank&utm_content=firstrun’

    e retorna o erro:

    org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
    ull,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{"32":"icon.png","48":"icon.png"},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Default","description":"The default theme.","creator":"Mozilla","homepageURL":null,"contributors":["Mozilla Contributors"]},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1470771432099,"updateDate":1470771432099,"applyBackgroundUpdates":1,"skinnable":true,"size":21899,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"48.0","maxVersion":"48.0"}],"targetPlatforms":[],"seen":true}
    1470771859128	addons.xpi	DEBUG	getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
    1470771859130	DeferredSave.extensions.json	DEBUG	Save changes
    1470771859130	addons.xpi	DEBUG	Updating database with changes to installed add-ons
    1470771859130	addons.xpi-utils	DEBUG	Updating add-on states
    1470771859131	addons.xpi-utils	DEBUG	Writing add-ons list
    1470771859134	addons.xpi	DEBUG	Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
    1470771859135	addons.xpi	DEBUG	Calling bootstrap method startup on [email protected] version 1.0
    1470771859136	addons.xpi	DEBUG	Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
    1470771859137	addons.xpi	DEBUG	Calling bootstrap method startup on [email protected] version 1.0.4
    1470771859137	addons.xpi	DEBUG	Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
    1470771859138	addons.xpi	DEBUG	Calling bootstrap method startup on [email protected] version 1.4.3
    1470771859166	addons.manager	DEBUG	Registering shutdown blocker for XPIProvider
    1470771859166	addons.manager	DEBUG	Provider finished startup: XPIProvider
    1470771859166	addons.manager	DEBUG	Starting provider: LightweightThemeManager
    1470771859167	addons.manager	DEBUG	Registering shutdown blocker for LightweightThemeManager
    1470771859167	addons.manager	DEBUG	Provider finished startup: LightweightThemeManager
    1470771859167	addons.manager	DEBUG	Starting provider: GMPProvider
    1470771859175	addons.manager	DEBUG	Registering shutdown blocker for GMPProvider
    1470771859176	addons.manager	DEBUG	Provider finished startup: GMPProvider
    1470771859176	addons.manager	DEBUG	Starting provider: PluginProvider
    1470771859176	addons.manager	DEBUG	Registering shutdown blocker for PluginProvider
    1470771859176	addons.manager	DEBUG	Provider finished startup: PluginProvider
    1470771859177	addons.manager	DEBUG	Completed startup sequence
    1470771860587	addons.manager	DEBUG	Starting provider: <unnamed-provider>
    1470771860587	addons.manager	DEBUG	Registering shutdown blocker for <unnamed-provider>
    1470771860588	addons.manager	DEBUG	Provider finished startup: <unnamed-provider>
    1470771860792	DeferredSave.extensions.json	DEBUG	Write succeeded
    1470771860792	addons.xpi-utils	DEBUG	XPI Database saved, setting schema version preference to 17
    1470771860792	DeferredSave.extensions.json	DEBUG	Starting timer
    1470771860815	DeferredSave.extensions.json	DEBUG	Starting write
    1470771860818	addons.repository	DEBUG	No addons.json found.
    1470771860818	DeferredSave.addons.json	DEBUG	Save changes
    1470771860821	DeferredSave.addons.json	DEBUG	Starting timer
    1470771860859	addons.manager	DEBUG	Starting provider: PreviousExperimentProvider
    1470771860859	addons.manager	DEBUG	Registering shutdown blocker for PreviousExperimentProvider
    1470771860859	addons.manager	DEBUG	Provider finished startup: PreviousExperimentProvider
    1470771860944	DeferredSave.addons.json	DEBUG	Starting write
    1470771860979	DeferredSave.extensions.json	DEBUG	Write succeeded
    1470771861007	DeferredSave.addons.json	DEBUG	Write succeeded
    
    	at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
    	at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
    	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
    	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
    	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
    	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
    	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
    	at testWebDriver.EncontrarElementos.setUp(EncontrarElementos.java:21)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    
    


  • @nayavsantos Oi Nayara, talvez seja pq o FirefoxDriver vai ser descontinuado e não suporta o FF 47, tem que usar o MarionetteDriver. O @Elias-Nogueira chegou a postar sobre isso recentemente: http://eliasnogueira.com/resolvendo-o-problema-de-execucao-com-selenium-no-firefox-47/

    A primeira resposta dessa thread no Stack Overflow tem uma explicação mais detalhada tb: http://stackoverflow.com/questions/37693106/selenium-2-53-not-working-on-firefox-47

    Caso não resolva, sugiro ir pro Chrome, é bem mais tranquilo hehe

    Abs



  • @stefanteixeira Muito obrigada, estava quebrando a cabeça com isso aqui. :D

    Muito obrigada também @Leonardo-Galani :D


  • MVP

    @stefanteixeira disse em Duvida automação com selenium Webdriver:

    @nayavsantos Oi Nayara, talvez seja pq o FirefoxDriver vai ser descontinuado e não suporta o FF 47, tem que usar o MarionetteDriver. O @Elias-Nogueira chegou a postar sobre isso recentemente: http://eliasnogueira.com/resolvendo-o-problema-de-execucao-com-selenium-no-firefox-47/

    A primeira resposta dessa thread no Stack Overflow tem uma explicação mais detalhada tb: http://stackoverflow.com/questions/37693106/selenium-2-53-not-working-on-firefox-47

    Caso não resolva, sugiro ir pro Chrome, é bem mais tranquilo hehe

    Abs

    E a galera para usar 47.0.1 estavam usando o jar 2.53.1 workaround



  • Escrevi um novo código seguindo o seguinte exemplo:
    http://www.taketest.com.br/2015/12/03/selenium-webdriver-primeiro-script-de-testes-no-eclipse/#comment-18120

    porém ja usando o marionette como descrito pelo @Elias-Nogueira

    Segue codigo:

    import static org.junit.Assert.*;
    import org.junit.After;
    import org.junit.Before;
    import org.junit.Test;
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.openqa.selenium.WebElement;
    
    
    public class ExemploTaketest {
    
    	private WebDriver driver;
    	@Before
    	public void setUp()
    	{
    		System.setProperty("webdriver.gecko.driver", "/Users/nvsantos/Dropbox/eclipse/geckodriver-v0.10.0-win64r");
    		
    		   DesiredCapabilities dc = DesiredCapabilities.firefox();
    		   dc.setCapability("marionette", true);
    				
    		   WebDriver driver = new FirefoxDriver(dc);
    		driver.get("http://www.taketest.com.br/");
    	}
    	
    	@Test
    	public void encontrarElementos()
    	{
    		WebElement menusobre = driver.findElement(By.id(("menu-item-19")));
    		assertTrue(menusobre.getText().contains("SOBRE"));
    		
    		WebElement topicosrecentes = driver.findElement(By.id("recent-posts-2"));
    		assertTrue(topicosrecentes.isDisplayed());
    		
    		WebElement tagwebdriver = driver.findElement(By.className("tag-link-32"));
    		assertTrue(tagwebdriver.getText().equals("Webdriver"));
    	}
    
    }
    
    ```Segue o erro:```
    org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
    nsions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1469568172326,"updateDate":1469568172326,"applyBackgroundUpdates":1,"skinnable":true,"size":21899,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"48.0","maxVersion":"48.0"}],"targetPlatforms":[],"seen":true}
    1470950444099	addons.xpi	DEBUG	getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
    1470950444100	DeferredSave.extensions.json	DEBUG	Save changes
    1470950444100	addons.xpi	DEBUG	Updating database with changes to installed add-ons
    1470950444101	addons.xpi-utils	DEBUG	Updating add-on states
    1470950444101	addons.xpi-utils	DEBUG	Writing add-ons list
    1470950444104	addons.xpi	DEBUG	Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
    1470950444105	addons.xpi	DEBUG	Calling bootstrap method startup on [email protected] version 1.0
    1470950444105	addons.xpi	DEBUG	Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
    1470950444105	addons.xpi	DEBUG	Calling bootstrap method startup on [email protected] version 1.0.4
    1470950444106	addons.xpi	DEBUG	Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
    1470950444107	addons.xpi	DEBUG	Calling bootstrap method startup on [email protected] version 1.4.3
    1470950444130	addons.xpi	DEBUG	Registering manifest for C:\Program Files\Mozilla Firefox\browser\extensions\{82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}.xpi
    1470950444131	addons.xpi	DEBUG	Calling bootstrap method startup on {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A} version 7.5.0.9082
    1470950444200	addons.manager	DEBUG	Registering shutdown blocker for XPIProvider
    1470950444201	addons.manager	DEBUG	Provider finished startup: XPIProvider
    1470950444201	addons.manager	DEBUG	Starting provider: LightweightThemeManager
    1470950444201	addons.manager	DEBUG	Registering shutdown blocker for LightweightThemeManager
    1470950444201	addons.manager	DEBUG	Provider finished startup: LightweightThemeManager
    1470950444202	addons.manager	DEBUG	Starting provider: GMPProvider
    1470950444209	addons.manager	DEBUG	Registering shutdown blocker for GMPProvider
    1470950444209	addons.manager	DEBUG	Provider finished startup: GMPProvider
    1470950444209	addons.manager	DEBUG	Starting provider: PluginProvider
    1470950444209	addons.manager	DEBUG	Registering shutdown blocker for PluginProvider
    1470950444210	addons.manager	DEBUG	Provider finished startup: PluginProvider
    1470950444210	addons.manager	DEBUG	Completed startup sequence
    1470950444697	addons.manager	DEBUG	Starting provider: <unnamed-provider>
    1470950444697	addons.manager	DEBUG	Registering shutdown blocker for <unnamed-provider>
    1470950444698	addons.manager	DEBUG	Provider finished startup: <unnamed-provider>
    1470950445020	DeferredSave.extensions.json	DEBUG	Write succeeded
    1470950445021	addons.xpi-utils	DEBUG	XPI Database saved, setting schema version preference to 17
    1470950445021	DeferredSave.extensions.json	DEBUG	Starting timer
    1470950445044	DeferredSave.extensions.json	DEBUG	Starting write
    1470950445056	addons.repository	DEBUG	No addons.json found.
    1470950445057	DeferredSave.addons.json	DEBUG	Save changes
    1470950445060	DeferredSave.addons.json	DEBUG	Starting timer
    1470950445090	addons.manager	DEBUG	Starting provider: PreviousExperimentProvider
    1470950445090	addons.manager	DEBUG	Registering shutdown blocker for PreviousExperimentProvider
    1470950445091	addons.manager	DEBUG	Provider finished startup: PreviousExperimentProvider
    1470950445099	DeferredSave.extensions.json	DEBUG	Write succeeded
    1470950445119	DeferredSave.addons.json	DEBUG	Starting write
    1470950445131	DeferredSave.addons.json	DEBUG	Write succeeded
    JavaScript error: resource://skype_ff_extension-at-jetpack/skype_ff_extension/data/c2c_options_menu_localization.js, line 189: TypeError: document.getElementById(...) is null
    
    	at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
    	at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
    	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
    	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
    	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
    	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:129)
    	at ExemploTaketest.setUp(ExemploTaketest.java:23)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    
    


  • @nayavsantos se eu fosse vc, fugiria do Firefox e iria logo pro Chrome…



  • @stefanteixeira porque?



  • @stefanteixeira Mas eu vou precisar usar o Chrome, Firefox e o IE



  • @nayavsantos aí complicou… Tenta fazer um downgrade do Firefox pra versão 46, caso realmente não esteja conseguindo usar com a 47.



  • Então acabei fazendo o que vc falou @stefanteixeira, estou fazendo meus testes usando o Chrome, pelo menos por enquanto, rsrs…
    Mas agora estou com outro problema, preciso selecionar um valor em um combo usando o webdriver, mas não estou sabendo como fazer, vou colocar o código html aqui em baixo, será que alguém sabe como eu faço isso? já tentei de várias formas e não consegui. :(

    <div id="divChamadoCliente" class="divConteudoCombo">
    <span id="lblCliente">Cliente:</span>
    <select id="cmbCliente" data-bind="combobox: clienteSelecionado, options: clientes, optionsValue: 'id', optionsText: 'nome'" name="ctl00$body$cmbCliente" style="display: none;">
    <option value="">SELECIONE</option>
    <option value="119">Adler Pti</option>
    <option value="103">Ahb-Caico</option>
    <option value="92">Ahb-Caraubas</option>
    <option value="159">Ahb-Currais Novos</option>
    <option value="91">Ahb-Pau dos Ferros</option>
    <option value="127">Arcelormittal - Juiz de Fora</option>
    <option value="122">B&q-Assu</option>
    <option value="94">B&q-Natal</option>
    <option value="199">B2D TECNOLOGIA LTDA</option>
    <option value="194">BCA BUREAU E EQUIPAMENTOS LTDA</option>
    <option value="128">Belgo - Cariacica</option>
    <option value="163">Biocor Instituto</option>
    <option value="120">Cabtec</option>
    <option value="156">Camilo dos Santos</option>
    <option value="171">Celpe</option>
    <option value="181">Celpe-Cabo</option>
    <option value="182">Celpe-Carpina</option>
    <option value="183">Celpe-Caruaru</option>
    <option value="184">Celpe-Garanhuns</option>
    <option value="179">Celpe-Norte</option>
    <option value="186">Celpe-Petrolina</option>
    <option value="185">Celpe-Serra Talhada</option>
    <option value="180">Celpe-Sul</option>
    <option value="153">Ceneged-Caruaru</option>
    <option value="155">Ceneged-Garanhuns</option>
    <option value="123">Cgb-Petrolina</option>
    <option value="154">Cgb-Serra Talhada</option>
    <option value="197">CLARO S.A.</option>
    <option value="196">CLIENTE TESTE - CLEDSON</option>
    <option value="192">CLILA CLIN EM ANAL DE LAB LTADA - ME</option>
    <option value="138">Cnh</option>
    <option value="170">Coelba</option>
    <option value="178">Coelba-Centro</option>
    <option value="174">Coelba-Metropolitano</option>
    <option value="177">Coelba-Norte</option>
    <option value="176">Coelba-Oeste</option>
    <option value="173">Coelba-Sudoeste</option>
    <option value="175">Coelba-Sul</option>
    <option value="172">Cosern</option>
    <option value="111">Dinamo-Alagoinhas</option>
    <option value="144">Dinamo-Cabo</option>
    <option value="157">Dinamo-Camacari</option>
    <option value="147">Dinamo-Carpina</option>
    <option value="113">Dinamo-Goianinha</option>
    <option value="140">Dinamo-Itapua</option>
    <option value="158">Dinamo-Macaiba</option>
    <option value="101">Dinamo-Metropolitano Norte</option>
    <option value="167">Dinamo-Metropolitano Sul</option>
    <option value="115">Dinamo-Natal</option>
    <option value="135">Dinamo-Nova Cruz</option>
    <option value="90">Dinamo-Parnamirim</option>
    <option value="95">Dinamo-Paulo Afonso</option>
    <option value="169">Dinamo-Ribeira do P</option>
    <option value="105">Dinamo-Sao Jose</option>
    <option value="193">DR. EYMARD MIRANDA GUIMARAES</option>
    <option value="146">Elmo Calcados - Centro</option>
    <option value="108">Embare</option>
    <option value="102">Engelmig-Eunapolis</option>
    <option value="134">Engelmig-Itabuna</option>
    <option value="106">Engelmig-Jequie</option>
    <option value="160">Engelmig-Santo Antoni</option>
    <option value="151">Engelmig-Valenca</option>
    <option value="164">Engelmig-Vitoria da C</option>
    <option value="121">Esab Industria e Comercio</option>
    <option value="88">Ezentis-Feira de Sant</option>
    <option value="99">Ezentis-Piraja</option>
    <option value="150">Ezentis-Praca da Se</option>
    <option value="139">Ezentis-Serrinha</option>
    <option value="114">Formtap Interni Sistemas Automotivos S/A</option>
    <option value="136">Gerdau Acominas</option>
    <option value="168">Granville-Irece</option>
    <option value="96">Granville-Itaberaba</option>
    <option value="100">Granville-Jacobina</option>
    <option value="162">Granville-Juazeiro</option>
    <option value="137">Granville-Senhor do B</option>
    <option value="89">Hospital Marcio Cunha</option>
    <option value="124">Hospital Mater Dei</option>
    <option value="130">Hospital Mater Dei S/A</option>
    <option value="87">I-Gas Embu Indiv. Adm. e Serv. de Glp Lt</option>
    <option value="110">Injeplastic</option>
    <option value="104">Inst Vida Patol Clinica Marilia LTDA</option>
    <option value="149">INSTITUTO HERMES PARDINI S.A</option>
    <option value="201">ITALY LINE FERRAGENS LTDA</option>
    <option value="117">Iveco - Sete Lagoas</option>
    <option value="93">Jamef - Contagem</option>
    <option value="143">Jfsteel-Barreiras</option>
    <option value="166">Jfsteel-Bom Jesus Da</option>
    <option value="107">Jfsteel-Brumado</option>
    <option value="98">Jfsteel-Guanambi</option>
    <option value="116">Jfsteel-Ibotirama</option>
    <option value="200">KKKK PLATAFORMA TESTE</option>
    <option value="190">LABORATORIO AN CLI DIAGNOSE S/S LTDA ME</option>
    <option value="195">LABORATORIO BIOCLINICO LTDA</option>
    <option value="145">Lifecenter</option>
    <option value="109">Lojas Rede - Caetes</option>
    <option value="118">Magneti Marelli - Betim</option>
    <option value="198">MED IMAGEM S/C</option>
    <option value="125">Megafort - Contagem</option>
    <option value="97">Megafort - Goias</option>
    <option value="161">Megafort - Vitoria</option>
    <option value="126">Novo Metropolitano S.A</option>
    <option value="148">Patrus Transportes - Matriz</option>
    <option value="191">PAULO SERGIO NETO SOARES</option>
    <option value="165">Petronas Lubrificantes Brasil S.A</option>
    <option value="142">Rent A Truck Operador Logistico LTDA</option>
    <option value="187">Sada Transportes</option>
    <option value="129">Sinaf Seguros</option>
    <option value="131">Suggar Eletrodomesticos</option>
    <option value="202">TESTE1</option>
    <option value="203">TESTE2</option>
    <option value="204">TESTE3</option>
    <option value="205">TESTE4</option>
    <option value="206">TESTE5</option>
    <option value="207">TESTE6</option>
    <option value="208">TESTE7</option>
    <option value="152">Unifort</option>
    <option value="141">Usiminas - Ipatinga</option>
    <option value="132">Usiminas Sp</option>
    <option value="112">Vallourec Tubos do Brasil S/A</option>
    <option value="133">Verdemar - Sion Loja 02</option>
    </select>
    <input class="ui-autocomplete-input custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left" onclick="this.select();" placeholder="SELECIONE" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true">
    <button class="ui-button ui-widget ui-state-default ui-button-icon-only ui-corner-right ui-button-icon" type="button" tabindex="-1" title="Exibir Todos" role="button" aria-disabled="false">
    </div>
    

  • MVP

    @nayavsantos Oi, e qual seria a dificuldade que está tendo com essa lista?



  • Eu não consigo selecionar nenhuma opção do combo, atualmente meu código está assim:

    	@Test
    	public void testCriarChamado() throws Exception {
    		driver.manage().window().maximize();
    		driver.findElement(By.id("lnkChamados")).click();
    		driver.findElement(By.id("lnkChamadoCriar")).click();
    
    		
    		 WebElement select = driver.findElement(By.id("cmbCliente"));
    		    List<WebElement> options = select.findElements(By.name("ctl00$body$cmbCliente"));
    		    for(WebElement option : options){
    		        if(option.getText().equals("Dinamo-Itapua")) {
    		            option.click();
    		            break;
    		        }
    		        
    		       
    		    }
    


  • Select dropdown = new Select(driver.findElement(By.id("cmbCliente")));
    
    dropdown.selectByVisibleText("Ahb-Caraubas ");
    

    ou

     dropdown.selectByValue("92");
    


  • @Leonardo-Galani com o código que vc me passou, retorna o erro abaixo:

    CriarChamado (2)
    gbhelpdesk.CriarChamado
    testCriarChamado(gbhelpdesk.CriarChamado)
    org.openqa.selenium.NoSuchElementException: Cannot locate element with text: Ahb-Caraubas 
    For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
    Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:32:46'
    System info: host: 'NOT002', ip: '169.254.218.171', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_101'
    Driver info: driver.version: unknown
    
    	at org.openqa.selenium.support.ui.Select.selectByVisibleText(Select.java:150)
    
    	at gbhelpdesk.CriarChamado.testCriarChamado(CriarChamado.java:51)
    
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    
    	at java.lang.reflect.Method.invoke(Unknown Source)
    
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    
    	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    
    	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    
    	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    
    	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    
    	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
    
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    
    
    
    
    

  • MVP

    Opa, beleza?

    Seguinte

    WebElement select = driver.findElement(By.id("cmbCliente"));
    

    Tu por acaso não precisa clicar para essa lista ficar visível?

    Algo tipo:

    WebElement select = driver.findElement(By.id("cmbCliente"));
    select.click();
    continue o código aqui...
    

    ??



  • Coloquei o código assim:

    	@Test
    	public void testCriarChamado() throws Exception {
    		driver.manage().window().maximize();
    		driver.findElement(By.id("lnkChamados")).click();
    		driver.findElement(By.id("lnkChamadoCriar")).click();
    
    		WebElement select = driver.findElement(By.id("cmbCliente"));
    		select.click();
    		Select dropdown = new Select(driver.findElement(By.id("cmbCliente")));
    		dropdown.selectByVisibleText("Ahb-Caraubas ");
    
    	}
    
    

    E o seguinte erro é retornado:

    CriarChamado (2)
    gbhelpdesk.CriarChamado
    testCriarChamado(gbhelpdesk.CriarChamado)
    org.openqa.selenium.ElementNotVisibleException: element not visible
      (Session info: chrome=52.0.2743.116)
      (Driver info: chromedriver=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129),platform=Windows NT 6.1.7601 SP1 x86) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 35 milliseconds
    Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:32:46'
    System info: host: 'NOT002', ip: '169.254.218.171', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_101'
    Driver info: org.openqa.selenium.chrome.ChromeDriver
    Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129), userDataDir=C:\Users\nvsantos\AppData\Local\Temp\scoped_dir7060_5365}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=52.0.2743.116, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
    Session ID: 4bde5179e92be9dbcebff5082a0beb5a
    
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    
    	at java.lang.reflect.Constructor.newInstance(Unknown Source)
    
    	at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    
    	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    
    	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
    
    	at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:327)
    
    	at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:85)
    
    	at gbhelpdesk.CriarChamado.testCriarChamado(CriarChamado.java:49)
    
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    
    	at java.lang.reflect.Method.invoke(Unknown Source)
    
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    
    	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    
    	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    
    	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    
    	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    
    	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
    
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    
    
    
    
    

 

Publicidade - Adsense

status at

16
Online

2.9k
Usuários

1.7k
Tópicos

5.7k
Posts

});