Skip to content

Instantly share code, notes, and snippets.

View douglasmartins7's full-sized avatar
🎯
Focusing

Douglas Martins douglasmartins7

🎯
Focusing
View GitHub Profile
if (digitos == juniper) {
WebElement verQuartos = driver.findElement(By.xpath("html/body/div[1]/div[2]/main/div/div/section/aside/div/div/div/div/div/a"));
verQuartos.click();
Thread.sleep(2000);
WebElement continuar = driver.findElement(By.xpath("html/body/div[1]/div[2]/main/div/div/section/div[3]/div[2]/aside/div/div/div/div/a"));
continuar.click();
} else if (digitos == expedia) {
System.out.println("Broker: " + digitos);
driver.navigate().refresh();
} else if (digitos == hotelbeds) {
public void OrigemComAjax(String origem, WebDriver driver){
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); // define o tempo de espera maximo para o carregamento de um elemento da pagina.
WebElement campoOrigem = driver.findElement(By.cssSelector("input[class='from txtOrigin grid-full autocomplete_empty']"));
campoOrigem.sendKeys(origem);
int limiteTentativas = 0;
while(this.validarRetornoAjaxOrigem(driver)){
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.cvc</groupId>
<artifactId>automacao_Site_Cvc_deslogado_Responsivo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>automacao_Site_Cvc_deslogado_Responsivo</name>
String janelaAtual = driver.getWindowHandle();
Set<String> janelas = driver.getWindowHandles();
for (String janela : janelas) {
driver.switchTo().window(janela);
if(driver.getCurrentURL().equals("URL DO BROWSER")) {
break;
}
}
@douglasmartins7
douglasmartins7 / Build
Created April 11, 2017 19:20
Build Maven
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<compileVersion>1.8</compileVersion>
@douglasmartins7
douglasmartins7 / Comandos uteis no maven
Created April 12, 2017 21:11
Comando uteis no maven
#Comandos úteis do Maven
Criação de Projeto
desktop java (jar)
mvn archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DarchetypeArtifactId=maven-archetype-quickstart \
-Dversion=1.0-SNAPSHOT \
-DgroupId=com.erkobridee.exemplo.mvn \
Fases do build
Algo interessante sobre este post é que o que será abordado é sempre referente a ‘um pouco’, ou ‘um pouco melhor’. Isso porque o maven é uma ferramenta bastante complexa dependendo do nível de customização e da necessidade que se tenha. A primeira parte do post cobre as fases executadas durante o build.
Uma fase nada mais é do que um estágio onde são executadas algumas regras sobre o projeto e se obtem algum resultado no final. Por exemplo, a fase de testes roda os testes da aplicação e obtém um ‘OK’ ou um ‘FAIL’, no segundo caso o build é interrompido. Tais fases são executadas dentro do ‘lifecycle‘ do build. O ‘lifecycle‘ é composto de ‘goals‘ e são estes:
Validate
Compile
Test
Package
print "Type the text with s:"
user_input = gets.chomp #gets method the object string that capture text user, chomp clean the line
user_input.downcase! #downcase method caixa baixa letter
if user_input.include? "s" #include if contains letter s return true
user_input.gsub!(/s/, "th") #gsub troca o s pelo th
else
print "Nothing to do here!"
end
@douglasmartins7
douglasmartins7 / Capybara
Created July 10, 2017 19:45
ruby-fedora-Capybara.md
dnf install ruby ruby-devel libxml2-devel redhat-rpm-config
If using mariadb, dnf install mariadb-devel
If using sqlite, dnf install sqlite-devel
gem install bundler
For gem capybara-webkit: (if you get error due to this gem)
dnf install qt-devel
QMAKE=/usr/bin/qmake-qt4 (in the same shell as bundle install)
bundle install or gem install capybara-webkit will now succeed
https://www.if-not-true-then-false.com/2010/install-google-chrome-with-yum-on-fedora-red-hat-rhel/