<commit_before>/**
 * http://surenpi.com
 */
package org.suren.autotest.web.framework.selenium.action;

import java.io.File;
import java.net.URL;

import org.openqa.selenium.WebElement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.suren.autotest.web.framework.autoit3.AutoItCmd;
import org.suren.autotest.web.framework.core.action.ClickAble;
import org.suren.autotest.web.framework.core.action.FileUploadAble;
import org.suren.autotest.web.framework.core.ui.Element;
import org.suren.autotest.web.framework.selenium.SeleniumEngine;
import org.suren.autotest.web.framework.selenium.strategy.SearchStrategyUtils;

/**
 * @author suren
 * @date 2016年7月19日 上午9:24:34
 */
@Component
public class SeleniumFileUpload implements FileUploadAble
{

	@Autowired
	private SeleniumEngine			engine;
	@Autowired
	private SearchStrategyUtils		searchStrategyUtils;
	@Autowired
	private ClickAble clickAble;
	
	@Override
	public boolean isEnabled(Element element)
	{
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isHidden(Element element)
	{
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean upload(Element element, URL url)
	{
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean upload(Element element, final File file)
	{
		WebElement webEle = searchStrategyUtils.findStrategy(WebElement.class, element).search(element);
		if(webEle != null)
		{
			final String title = "打开";
//			title = "选择要上载的问加你，通过：192.168.8.120";
			
			new Thread()
			{
				@Override
				public void run()
				{
					AutoItCmd.execFileChoose(title, file);
					System.out.println("exec auit3 over");
				}
			}.start();
			
			try
			{
				Thread.sleep(1000);
			}
			catch (InterruptedException e)
			{
				e.printStackTrace();
			}
			
			click(element);
			
			return true;
		}
		
		return false;
	}

	@Override
	public boolean click(Element element)
	{
		clickAble.click(element);
		return false;
	}
}<commit_msg>增加文件上传的延迟<commit_after>/**
 * http://surenpi.com
 */
package org.suren.autotest.web.framework.selenium.action;

import java.io.File;
import java.net.URL;

import org.openqa.selenium.WebElement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.suren.autotest.web.framework.autoit3.AutoItCmd;
import org.suren.autotest.web.framework.core.action.ClickAble;
import org.suren.autotest.web.framework.core.action.FileUploadAble;
import org.suren.autotest.web.framework.core.ui.Element;
import org.suren.autotest.web.framework.selenium.SeleniumEngine;
import org.suren.autotest.web.framework.selenium.strategy.SearchStrategyUtils;

/**
 * @author suren
 * @date 2016年7月19日 上午9:24:34
 */
@Component
public class SeleniumFileUpload implements FileUploadAble
{

	@Autowired
	private SeleniumEngine			engine;
	@Autowired
	private SearchStrategyUtils		searchStrategyUtils;
	@Autowired
	private ClickAble clickAble;
	
	@Override
	public boolean isEnabled(Element element)
	{
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isHidden(Element element)
	{
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean upload(Element element, URL url)
	{
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean upload(Element element, final File file)
	{
		WebElement webEle = searchStrategyUtils.findStrategy(WebElement.class, element).search(element);
		if(webEle != null)
		{
			final String title = "打开";
//			title = "选择要上载的问加你，通过：192.168.8.120";
			
			new Thread()
			{
				@Override
				public void run()
				{
					AutoItCmd.execFileChoose(title, file);
					System.out.println("exec auit3 over");
				}
			}.start();
			
			try
			{
				Thread.sleep(1000);
			}
			catch (InterruptedException e)
			{
				e.printStackTrace();
			}
			
			click(element);
			
			try
			{
				Thread.sleep(2000);
			}
			catch (InterruptedException e)
			{
				e.printStackTrace();
			}
			
			return true;
		}
		
		return false;
	}

	@Override
	public boolean click(Element element)
	{
		clickAble.click(element);
		return false;
	}
}
{'fraction_non_alphanumeric': 0.10984848484848485, 'fraction_numerical': 0.014204545454545454, 'mean_word_length': 3.763246899661781, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3960891', 'n_tokens_mistral': 1660, 'n_tokens_neox': 1440, 'n_words': 276}