Skip to content

Commit

Permalink
hotfix to register externally created driver outside of IDriverPool
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelendik committed May 7, 2021
1 parent 3e6192a commit 650d77d
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@

import com.qaprosoft.carina.core.foundation.commons.SpecialKeywords;
import com.qaprosoft.carina.core.foundation.crypto.CryptoTool;
import com.qaprosoft.carina.core.foundation.exception.DriverPoolException;
import com.qaprosoft.carina.core.foundation.performance.ACTION_NAME;
import com.qaprosoft.carina.core.foundation.utils.Configuration;
import com.qaprosoft.carina.core.foundation.utils.Configuration.Parameter;
Expand Down Expand Up @@ -230,7 +231,13 @@ private ExtendedWebElement(WebElement element) {
}
//this.driver = (WebDriver) tempSearchContext;
// that's the only place to use DriverPool to get driver.
this.driver = IDriverPool.getDriver(sessionId);
try {
//try to search securely in driver pool by sessionId
this.driver = IDriverPool.getDriver(sessionId);
} catch (DriverPoolException ex) {
// seems like driver started outside of IDriverPool so try to register it as well
this.driver = (WebDriver) tempSearchContext;
}
} else {
LOGGER.error("Undefined error for searchContext: " + tempSearchContext.toString());
}
Expand Down

0 comments on commit 650d77d

Please sign in to comment.