[Vue warn]: Injection "$validator" not found Error on attempt to use vee-validate - vuejs2

I'm new to VueJS so I decided to use it for a small project. I needed to validate client entries..I googled and found vee-validate would be appropriate for my style of creating a component so I used the style found in this post https://jsfiddle.net/787g7q0e/ Below are the steps I took to reproduce the error I got.
First, I installed the vee-validate via a CDN link like so:
<script src="~/Scripts/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vee-validate#latest/dist/vee-validate.js"></script>
<script src="~/Scripts/FrontEnd/Layout/Main.js"></script>
in my Layout file for APS.NET MVC
Secondly, following https://jsfiddle.net/787g7q0e/, I registered and used vee-validate like so:
const config = {
aria: false,
classNames: {},
classes: false,
delay: 0,
errorBagName: 'errors',
events: 'input|blur',
fieldsBagName: 'fields',
i18n: null,
i18nRootKey: 'validations',
inject: true,
locale: 'en',
strict: true,
validity: false
}
Vue.use(VeeValidate, config);
Vue.component('loan-calc', {
template: `<div class="row calc-holder" data-aos="fade-up" data-aos-delay="800">
<form>
<div class="wrap">
<div class="card_one">
<label for="">Loan Amount</label>
<p>The amount you want to take</p>
<div class="loan-amount-form">
<i class="icon naira">
<svg width="15"
height="13"
viewBox="0 0 15 13"
fill="none"
xmlns="http://www.w3.org/2000/svg">
<path opacity="0.4"
d="M14.814 5.764H13.302V7.726H14.814V9.22H13.302V13H11.286L8.244 9.22H4.716V13H2.232V9.22H0.684V7.726H2.232V5.764H0.684V4.288H2.232V0.219999H4.158L7.38 4.288H10.818V0.237999H13.302V4.288H14.814V5.764ZM4.716 7.726H7.056L5.472 5.764H4.716V7.726ZM10.116 7.726H10.818V5.764H8.55L10.116 7.726Z"
fill="#03293D" />
</svg>
</i>
<input
type="text"
name="LoanAmount"
v-validate="'required'"
v-model="LoanAmount"/>
<i class="icon pencil">
<svg width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg">
<path opacity="0.4"
d="M10 0C4.47 0 0 4.47 0 10C0 15.53 4.47 20 10 20C15.53 20 20 15.53 20 10C20 4.47 15.53 0 10 0ZM13.1035 5.0684C13.2435 5.0684 13.3833 5.1224 13.4883 5.2324L14.7676 6.5117C14.9876 6.7217 14.9876 7.0732 14.7676 7.2832L13.7676 8.2812L11.7188 6.2324L12.7188 5.2324C12.8237 5.1224 12.9635 5.0684 13.1035 5.0684ZM11.1289 6.8145L13.1875 8.8711L7.12891 14.9316H5.06836V12.8711L11.1289 6.8145Z"
fill="#03293D" />
</svg>
</i>
</div>
</div>
</div>
</form>
</div>`,
data() {
return {
LoanAmount: null,
LoanTenure: null,
RepaymentType: null,
Repayment: null
}
}
})
From the above template, I tried using vee-validate to validate the required field like so:
<input
type="text"
name="LoanAmount"
v-validate="'required'"
v-model="LoanAmount"/>
<i class="icon pencil">
<svg width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg">
<path opacity="0.4"
d="M10 0C4.47 0 0 4.47 0 10C0 15.53 4.47 20 10 20C15.53 20 20 15.53 20 10C20 4.47 15.53 0 10 0ZM13.1035 5.0684C13.2435 5.0684 13.3833 5.1224 13.4883 5.2324L14.7676 6.5117C14.9876 6.7217 14.9876 7.0732 14.7676 7.2832L13.7676 8.2812L11.7188 6.2324L12.7188 5.2324C12.8237 5.1224 12.9635 5.0684 13.1035 5.0684ZM11.1289 6.8145L13.1875 8.8711L7.12891 14.9316H5.06836V12.8711L11.1289 6.8145Z"
fill="#03293D" />
Kindly help or show me how I can resolve the above error and use vee-validate effectively.

Related

Vue 3 getting selected date from datepicker

I am building a date picker using Flowbite Datepicker Plugin: https://flowbite.com/docs/plugins/datepicker/ . Here is my html code:
<form #submit.prevent="checkAvailability" method="POST" class="space-y-6">
<div class="items-center">
<label for="start" class="text-sm">Pick Up Date</label>
<div class="relative mb-4">
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
<svg class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clip-rule="evenodd"></path></svg>
</div>
<input datepicker datepicker-autohide v-model="startDate" type="text" class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Select date">
</div>
</div>
<div>
<button type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">Check Availability</button>
</div>
</form>
and here is my Vue JS Code:
<script>
export default {
data(){
return {
startDate: '',
}
},
methods:{
checkAvailability(e) {
console.log("start date", this.startDate);
}
}
}
However, when I try to print start date in the console, it is showing as empty even if I had selected the date in the date picker.
I have tried to set #change method, but it seems like the function of onChange is not being called once I set the date.
Any help is appreacited!
Not 100% sure - but the plugin does not update in a vue way. I guess it is because the value is set by javascript, so no change event will raise.
It looks like the "data.startDate" is not updated when you click on a date but if you type something it will be changed.
What you can do is a "workaround", make a ref in the input
<input ref="datepicker1" datepicker ...>
and and use the refs value like that
console.log(this.$refs.datepicker1.value);
Just writing because you appreciate any help

VueJS file upload field cannot be reset

In my vuejs application, I have a modal to insert some user data with a file upload.
I should be able to clear all the form fields once when an user successfully upload any content.
All my fields get reset apart from the file upload field.
It will remained as it is.
Inside my form.vue, for the file upload I have
<div class="mb-1">
<dashboard-input-label
identifier="document"
:settings="{ help: true, helpDirection: 'left' }"
>
Upload document
<template slot="helpText">
Maximum filesize is 5 MB. The default allowed file extensions
are: pdf, jpeg and png.
</template>
</dashboard-input-label>
<validator-v2
:identifier="identifier"
name="document_file"
:rules="{ required: { message: 'Document is required.' } }"
>
<custom-file-upload
ref="documentDocument"
v-model="documentFile"
:max-upload-file-size="5"
name="document_file"
></custom-file-upload>
</validator-v2>
</div>
and following is my button
<loading-button ref="submitBtn" size="normal">
Save & Add new
</loading-button>
This is my submitBtn method,
storeDocumentAndAddNew() {
this.isAddNew = true
const loader = this.$refs.submitBtn
this.storeDocument(loader)
},
And for the field reset I have followings,
reset() {
this.documentName= null
this.dateOfIssue= null
this.expiryDate= null
this.documentNumber = null
this.doesNotHaveDocumentNumber = false
this.doesNotExpire = false
this.documentFile = null
this.doesOptIn = false
this.isAddNew = false
this.documentFile = ''
this.$refs.documentDocument.value = null
},
Once I hit submit, every field get reset except this file upload field.
Following is my custom-file-upload.vue component
<template>
<div>
<div class="flex items-center flex-wrap">
<div #click="selectFile" class="flex items-center cursor-pointer w-full form-input custom-file-upload ">
<p class="flex justify-between items-center w-full overflow-hidden">
<span class="font-regular text-base flex items-center justify-center">
<span v-if="filename !== null">{{ filename | limitString }} </span>
<span class="cs--file-upload-current-file overflow-hidden inline-block" v-else><slot
name="currentFile"></slot></span>
</span>
<span class="text-certstyle-text-light ">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="feather feather-upload"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline
points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg>
</span>
</p>
<input #change="showFileName" ref="fileInput" type="file" :name="name">
<div class="flex flex-col fixed top-0 right-0 z-50">
<toastr-alert #hidden="resetToastrMessage" v-if="message !== ''" :message="message"
:type="type"></toastr-alert>
</div>
</div>
</div>
</div>
</template>
Even though I've used, this.$refs.documentDocument.value = null it's not clearing my file upload field....
Update
I have used #wendt88's answer and then the file is removed. But the previously uploaded, document's name will be remained there as it is..As an example, if I tried to upload a document called, dummy.pdf, it'll show the dummy.pdf text even after a successful submission...
Now my reset looks likes this,
reset() {
this.documentName= null
this.dateOfIssue= null
this.expiryDate= null
this.documentNumber = null
this.doesNotHaveDocumentNumber = false
this.doesNotExpire = false
this.documentFile = null
this.doesOptIn = false
this.isAddNew = false
this.$refs.documentDocument.$refs.fileInput.value = null
},
Following is my complete custom-file-upload.vue
<template>
<div>
<div class="flex items-center flex-wrap">
<div #click="selectFile" class="flex items-center cursor-pointer w-full form-input custom-file-upload ">
<p class="flex justify-between items-center w-full overflow-hidden">
<span class="font-regular text-base flex items-center justify-center">
<span v-if="filename !== null">{{ filename | limitString }} </span>
<span class="cs--file-upload-current-file overflow-hidden inline-block" v-else><slot
name="currentFile"></slot></span>
</span>
<span class="text-certstyle-text-light ">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="feather feather-upload"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline
points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg>
</span>
</p>
<input #change="showFileName" ref="fileInput" type="file" :name="name">
<div class="flex flex-col fixed top-0 right-0 z-50">
<toastr-alert #hidden="resetToastrMessage" v-if="message !== ''" :message="message"
:type="type"></toastr-alert>
</div>
</div>
</div>
</div>
</template>
<style lang="scss" scoped>
.custom-file-upload input {
position: absolute;
cursor: pointer;
height: 0;
width: 0;
opacity: 0;
}
.cs--file-upload-current-file {
max-width: 220px;
}
label {
font-weight: 400 !important;
}
</style>
<script>
// Mixins
import HasToastrMessage from '#/Mixins/HasToastrMessage.js';
// Helper
import Helper from '#/Support/Helper.js';
export default {
mixins: [HasToastrMessage],
props: ['name', 'value', 'maxUploadFileSize'],
data() {
return {
file: null,
filename: null,
message: "",
type: "",
fileSize: 0,
maxFileSize: 10,
validFileTypes: [
'application/pdf',
'image/jpeg',
'image/png'
]
}
},
mounted() {
if (Helper.isset(this.maxUploadFileSize)) {
this.maxFileSize = this.maxUploadFileSize;
}
},
methods: {
showFileName(e) {
this.filename = collect(e.target.value.split('\\')).last();
let file = e.target.files[0];
let fileSize = file.size / 1000000;
if (fileSize > this.maxFileSize) {
this.showToastrErrorMessage(`The uploaded file is too big. Max size: ${this.maxFileSize} MB.`);
this.$refs.fileInput.value = null
this.filename = null
} else if (!this.validFileTypes.includes(file.type)) {
this.showToastrErrorMessage(`The uploaded file is invalid. Please upload valid type.`);
this.$refs.fileInput.value = null
this.filename = null
} else if (this.filename) {
this.file = file
this.showToastrSuccessMessage(`Your file is successfully uploaded.`);
this.$emit('uploaded')
} else {
this.showToastrErrorMessage(`Your file could not be uploaded. Please try again.`);
}
},
resetToastrMessage() {
this.message = "";
this.type = "";
},
selectFile() {
this.$refs.fileInput.click();
},
}
}
</script>
this.$refs.documentDocument is a vue component, to clear it´s value property use this.$set(this.$refs.documentDocument, 'value', null) -> https://v2.vuejs.org/v2/guide/reactivity.html
otherwise documentDocument does not know that you have changed it´s value
but if you want to clear the file input value, run (https://stackoverflow.com/a/16222877/1826106):
this.$refs.documentDocument.$refs.fileInput.value = null;
this.$set(this.$refs.documentDocument, 'filename', null);

jest chai vuejs trigger('click') not working

i try to create a simple test who :
click on button
show if dropdown is open
i try to simulate a click with trigger but it is not working,
do you have any idea what i am doing wrong?
describe('test clique boutton filtre', () => {
test('should show dropdown de la colonne 1', async (done) => {
const dropdown = wrapper.find('#nom-divUpperDrop')
const button = wrapper.find('#nom-dropdown')
await button.trigger('click')
expect(dropdown.findAll('.show').length).equal(1)
done()
})
})
i'am sure i find the button because the console log show :
<button type="button" id="nom-dropdown" data-bs-toggle="dropdown" aria-bs-haspopup="true" aria-bs-expanded="false" data-bs-offset="-60,10" data-bs-auto-close="outside" class="nav-icon clear-btn">
<p> false </p>
</button>
here the dropdown where i want to find the .show
> <div aria-labelledby="nom-dropdown" class="dropdown-menu">
> <div>
> <div class="filter-deroulant">
> <!---->
> <div class="filter-input">
> <div class="input-group mb-3"><input type="text" id="filtre_0" value="" placeholder="Recherche par nom"
> aria-label="Rechercher" aria-describedby="nom" class="form-control col
> form-control-sm"> <button type="button" id="nom" class="btn
> btn-outline-secondary"><svg aria-hidden="true" focusable="false"
> data-prefix="fas" data-icon="search" role="img"
> xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"
> aria-expanded="false" class="svg-inline--fa fa-search fa-w-16">
> <path fill="currentColor" d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0
> 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4
> 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"
> class=""></path>
> </svg></button></div>
> </div>
> </div>
> </div>
> <div>
Any idea?
ps: i tried this : Vue Testing (JEST): button.trigger('click') not working
ps: I tried the button manually, it's work :)
but it's not working for me

Xpath is invalid: TypeError: The expression cannot be converted to return the specified type

I am using selenium using Robot Framework I'm getting
xpath is invalid: TypeError: The expression cannot be converted to return the specified type.
The code I used is
Set Test Variable ${xpathIP} xpath=//ul/li/div[#class="segmentName"]
${IPSegmentsCnt}= Get Matching Xpath Count ${xpathIP}
Log ${IPSegmentsCnt}
:For ${i} IN RANGE 1 ${IPSegmentsCnt} + 1
\ ${name}= Get Text xpath=(${xpathIP})[${i}]
\ Log ${name}
\ Should Not Match Regexp ${name} \\(DS:.+\\)
I'm not getting what exactly the error is...
HTML:
<li _ngcontent-ats-90="">
<span _ngcontent-ats-90="" ng-reflect-class-name="arrow collapse-false" class="arrow collapse-false"></span>
<md-checkbox _ngcontent-ats-90="" class="mat-accent mat-checkbox ng-untouched ng-pristine ng-valid" ng-reflect-name="4INFO IP Segments"><label class="mat-checkbox-layout"><div class="mat-checkbox-inner-container"><input class="mat-checkbox-input cdk-visually-hidden" type="checkbox" ng-reflect-id="input-md-checkbox-1" id="input-md-checkbox-1" ng-reflect-name="4INFO IP Segments" name="4INFO IP Segments" tabindex="0" aria-label="">
<div class="mat-checkbox-ripple mat-ripple" md-ripple="" ng-reflect-trigger="[object HTMLElement]" ng-reflect-centered="true" ng-reflect-speed-factor="0.3"></div><div class="mat-checkbox-frame"></div><div class="mat-checkbox-background"><svg xml:space="preserve" class="mat-checkbox-checkmark" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path class="mat-checkbox-checkmark-path" d="M4.1,12.7 9,17.6 20.3,6.3" fill="none" stroke="white"></path></svg><div class="mat-checkbox-mixedmark"></div></div></div><span class="mat-checkbox-label">
</span></label></md-checkbox>
<div _ngcontent-ats-90="" class="datasourceName">4INFO IP Segments false</div>
<ul _ngcontent-ats-90="">
<li _ngcontent-ats-90="">
<md-checkbox _ngcontent-ats-90="" class="mat-accent mat-checkbox ng-untouched ng-pristine ng-valid" ng-reflect-name="4Info_Age_18-30"><label class="mat-checkbox-layout"><div class="mat-checkbox-inner-container"><input class="mat-checkbox-input cdk-visually-hidden" type="checkbox" ng-reflect-id="input-md-checkbox-2" id="input-md-checkbox-2" ng-reflect-name="4Info_Age_18-30" name="4Info_Age_18-30" tabindex="0" aria-label=""><div class="mat-checkbox-ripple mat-ripple" md-ripple="" ng-reflect-trigger="[object HTMLElement]" ng-reflect-centered="true" ng-reflect-speed-factor="0.3"></div><div class="mat-checkbox-frame"></div><div class="mat-checkbox-background"><svg xml:space="preserve" class="mat-checkbox-checkmark" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path class="mat-checkbox-checkmark-path" d="M4.1,12.7 9,17.6 20.3,6.3" fill="none" stroke="white"></path></svg><div class="mat-checkbox-mixedmark"></div></div></div><span class="mat-checkbox-label">
</span></label></md-checkbox>
<div _ngcontent-ats-90="" class="segmentName">4Info_Age_18-30 (DS: 0) (CPM: $1.00)</div>
</li><li _ngcontent-ats-90="">
<md-checkbox _ngcontent-ats-90="" class="mat-accent mat-checkbox ng-untouched ng-pristine ng-valid" ng-reflect-name="4Info_Age_35_and_over"><label class="mat-checkbox-layout"><div class="mat-checkbox-inner-container"><input class="mat-checkbox-input cdk-visually-hidden" type="checkbox" ng-reflect-id="input-md-checkbox-3" id="input-md-checkbox-3" ng-reflect-name="4Info_Age_35_and_over" name="4Info_Age_35_and_over" tabindex="0" aria-label=""><div class="mat-checkbox-ripple mat-ripple" md-ripple="" ng-reflect-trigger="[object HTMLElement]" ng-reflect-centered="true" ng-reflect-speed-factor="0.3"></div><div class="mat-checkbox-frame"></div><div class="mat-checkbox-background"><svg xml:space="preserve" class="mat-checkbox-checkmark" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path class="mat-checkbox-checkmark-path" d="M4.1,12.7 9,17.6 20.3,6.3" fill="none" stroke="white"></path></svg><div class="mat-checkbox-mixedmark"></div></div></div><span class="mat-checkbox-label">
</span></label></md-checkbox>
<div _ngcontent-ats-90="" class="segmentName">4Info_Age_35_and_over (DS: 0) (CPM: $1.00)</div>
</li><li _ngcontent-ats-90="">
<md-checkbox _ngcontent-ats-90="" class="mat-accent mat-checkbox ng-untouched ng-pristine ng-valid" ng-reflect-name="4Info_Age_50_plus"><label class="mat-checkbox-layout"><div class="mat-checkbox-inner-container"><input class="mat-checkbox-input cdk-visually-hidden" type="checkbox" ng-reflect-id="input-md-checkbox-4" id="input-md-checkbox-4" ng-reflect-name="4Info_Age_50_plus" name="4Info_Age_50_plus" tabindex="0" aria-label=""><div class="mat-checkbox-ripple mat-ripple" md-ripple="" ng-reflect-trigger="[object HTMLElement]" ng-reflect-centered="true" ng-reflect-speed-factor="0.3"></div><div class="mat-checkbox-frame"></div><div class="mat-checkbox-background"><svg xml:space="preserve" class="mat-checkbox-checkmark" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path class="mat-checkbox-checkmark-path" d="M4.1,12.7 9,17.6 20.3,6.3" fill="none" stroke="white"></path></svg><div class="mat-checkbox-mixedmark"></div></div></div><span class="mat-checkbox-label">
</span></label></md-checkbox>
<div _ngcontent-ats-90="" class="segmentName">4Info_Age_50_plus (DS: 0) (CPM: $1.00)</div>
</li><li _ngcontent-ats-90="">
</ul>
</li>
I tried multiple times that wasn't worked
The problem could be that you are assigning the xpath twice so ${name} looks for something like this xpath=xpath='yourxpath'
Change
${IPSegmentsCnt}= Get Matching Xpath Count ${xpathIP}
Set Test Variable ${xpathIP} xpath=//ul/li/div[#class="segmentName"]
to
Set Test Variable ${xpathIP} //ul/li/div[#class="segmentName"]
${IPSegmentsCnt}= Get Matching Xpath Count xpath=${xpathIP}

selenium whatsapp button search vba

I have a big problem !!! After a few days of normal use suddenly I can no longer select the button key number of web whatsapp!
The environment is Chrome and I use Selenium web driver ... I'm trying to do all the searches for different tags but nothing ...
This is the code
bot.wait 4000
bot.findElementByClassName("C28xL").Click
I also tried using different parts but nothing ... even with xpath or css but maybe I'm wrong.
button search whatsapp web
Button to select.
<div class="gQzdc"><button class="C28xL"><div class="_1M3wR _1BC4w"><span class="" data-icon="back-blue"><svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="#4FC3F7" d="M20 11H7.8l5.6-5.6L12 4l-8 8 8 8 1.4-1.4L7.8 13H20v-2z"></path></svg></span></div><div class="_1M3wR _3M2St"><span class="" data-icon="search"><svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="#263238" fill-opacity=".3" d="M15.009 13.805h-.636l-.22-.219a5.184 5.184 0 0 0 1.256-3.386 5.207 5.207 0 1 0-5.207 5.208 5.183 5.183 0 0 0 3.385-1.255l.221.22v.635l4.004 3.999 1.194-1.195-3.997-4.007zm-4.808 0a3.605 3.605 0 1 1 0-7.21 3.605 3.605 0 0 1 0 7.21z"></path></svg></span></div></button><span></span><div class="_2cLHw">Cerca o inizia una nuova chat</div><label class="_2MSJr"><input value="" title="Cerca o inizia una nuova chat" dir="auto" data-tab="2" class="jN-F5 copyable-text selectable-text" type="text"></label></div>
Screenshot of more html for page:
<div class="gQzdc">
<button class="C28xL">
<div class="_1M3wR _1BC4w">
<span class="" data-icon="back-blue">
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<path fill="#4FC3F7" d="M20 11H7.8l5.6-5.6L12 4l-8 8 8 8 1.4-1.4L7.8 13H20v-2z"></path>
</svg>
</span>
</div>
<div class="_1M3wR _3M2St">
<span class="" data-icon="search">
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<path fill="#263238" fill-opacity=".3" d="M15.009 13.805h-.636l-.22-.219a5.184 5.184 0 0 0 1.256-3.386 5.207 5.207 0 1 0-5.207 5.208 5.183 5.183 0 0 0 3.385-1.255l.221.22v.635l4.004 3.999 1.194-1.195-3.997-4.007zm-4.808 0a3.605 3.605 0 1 1 0-7.21 3.605 3.605 0 0 1 0 7.21z">
</path>
</svg>
</span>
</div>
</button>
<span>
</span>
<div class="_2cLHw">Cerca o inizia una nuova chat</div>
<label class="_2MSJr">
<input value="" title="Cerca o inizia una nuova chat" dir="auto" data-tab="2" class="jN-F5 copyable-text selectable-text" type="text">
</label>
</div>
Up until Friday everything worked great. I also updated the webdriver at 2.42 and chrome was updated to 69.
how can I do?
As per the HTML you have shared the element is a dynamic element so you have to induce Wait for the element to be clickable and you can use the following solutions:
bot.wait 4000
bot.FindElementByXPath("//input[contains(#class,'copyable-text selectable-text') and #title='Cerca o inizia una nuova chat']").Click
Note: As an enhancement you need to replae the wait by WebDriverWait