<commit_before>package co.com.sura.webTest;

import org.jbehave.web.selenium.DelegatingWebDriverProvider;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.phantomjs.PhantomJSDriver;
import org.openqa.selenium.phantomjs.PhantomJSDriverService;
import org.openqa.selenium.remote.DesiredCapabilities;

public class PhantomJSDelegateWebDriverProvider extends DelegatingWebDriverProvider {
	
	private String phantomJSDriverPath;
	
	private PhantomJSDelegateWebDriverProvider(String phantomJSDriverPath) 
	{
		this.phantomJSDriverPath = phantomJSDriverPath;
	}
	
	public static PhantomJSDelegateWebDriverProvider getDriverWithPath(String phantomJSDriverPath){
		return new PhantomJSDelegateWebDriverProvider(phantomJSDriverPath);		
	}

	public static PhantomJSDelegateWebDriverProvider getDriverWithJsDirverOnPath(){
		return new PhantomJSDelegateWebDriverProvider("");		
	}





	public void initialize() {
		DesiredCapabilities capabilities = DesiredCapabilities
				.internetExplorer();
		capabilities.setJavascriptEnabled(true);
		capabilities.setCapability("takesScreenshot", true);
		if (phantomJSDriverPath != "") {
			capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, 
				phantomJSDriverPath);		
		}				

		PhantomJSDriver driver = new PhantomJSDriver(capabilities); 
		//Por custiones del PhantomJS se debe auentar el tamanho de la ventana para que los 
		//elementos sean visibles. Sin esto, fallan algunas aplicaciones
		aumentarTamanoDeVentanaEnPhantonJS(driver);
		System.out.println("cargo el driver=" + driver);
		delegate.set(driver);
		
	}
	
	private void aumentarTamanoDeVentanaEnPhantonJS(PhantomJSDriver driver) {
		driver.manage().window().setSize( new Dimension(1024, 768));
	}

}
<commit_msg>Refactor: Se extrae el método createDesiredCapabilites<commit_after>package co.com.sura.webTest;

import org.jbehave.web.selenium.DelegatingWebDriverProvider;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.phantomjs.PhantomJSDriver;
import org.openqa.selenium.phantomjs.PhantomJSDriverService;
import org.openqa.selenium.remote.DesiredCapabilities;

public class PhantomJSDelegateWebDriverProvider extends DelegatingWebDriverProvider {
	
	private String phantomJSDriverPath;
	
	private PhantomJSDelegateWebDriverProvider(String phantomJSDriverPath) 
	{
		this.phantomJSDriverPath = phantomJSDriverPath;
	}
	
	public static PhantomJSDelegateWebDriverProvider getDriverWithPath(String phantomJSDriverPath){
		return new PhantomJSDelegateWebDriverProvider(phantomJSDriverPath);		
	}

	public static PhantomJSDelegateWebDriverProvider getDriverWithJsDirverOnPath(){
		return new PhantomJSDelegateWebDriverProvider("");		
	}





	public void initialize() {
		DesiredCapabilities capabilities = createDesiredCapabilities();				

		PhantomJSDriver driver = new PhantomJSDriver(capabilities); 
		//Por custiones del PhantomJS se debe auentar el tamanho de la ventana para que los 
		//elementos sean visibles. Sin esto, fallan algunas aplicaciones
		aumentarTamanoDeVentanaEnPhantonJS(driver);
		System.out.println("cargo el driver=" + driver);
		delegate.set(driver);
		
	}

	protected DesiredCapabilities createDesiredCapabilities() {
		DesiredCapabilities capabilities = DesiredCapabilities
				.internetExplorer();
		capabilities.setJavascriptEnabled(true);
		capabilities.setCapability("takesScreenshot", true);
		if (phantomJSDriverPath != "") {
			capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, 
				phantomJSDriverPath);		
		}
		return capabilities;
	}
	
	private void aumentarTamanoDeVentanaEnPhantonJS(PhantomJSDriver driver) {
		driver.manage().window().setSize( new Dimension(1024, 768));
	}

}

{'fraction_non_alphanumeric': 0.0747512772250605, 'fraction_numerical': 0.003764452809895133, 'mean_word_length': 6.380952380952381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2022113', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1122, 'n_words': 203}