|
I am planning to use OpenQA.Selenium to automate website filling in Google Chrome.
Here is the part of vb.net code,
<pre>Public driver1 As ChromeDriver = Nothing
Public WithEvents driver As EventFiringWebDriver
Dim service As ChromeDriverService = ChromeDriverService.CreateDefaultService
Dim chromeOptions As New OpenQA.Selenium.Chrome.ChromeOptions()
chromeOptions.AddExcludedArgument("ignore-certifcate-errors")
chromeOptions.AddArgument("test-type")
service.HideCommandPromptWindow = True
driver1 = New ChromeDriver(service, chromeOptions)
Here,
driver_Navigated fired only when pages are navigated using code. When I navigate manually in Chrome browser driver_Navigated is not firing.
What mistake is there in my code?
Are there any other working example codes for Website automation in Chrome?
Please help.
|
|
|
|
|
Did you install the chrome driver? Is it available in the system path?
ChromeDriver is maintained / supported by the Chromium project iteslf. WebDriver works with Chrome through the chromedriver binary (found on the chromium project’s download page). You need to have both chromedriver and a version of chrome browser installed. chromedriver needs to be placed somewhere on your system’s path in order for WebDriver to automatically discover it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I have installed chrome driver and it is available for the program.
|
|
|
|
|
"Available" means that it can be found in the system path? If unsure, open a console and type "path", it should include the directory where the driver can be found. It would also be helpfull to test it with another driver (like one for IE) to ensure that it is the driver that is causing the problems, not some other part.
Next to that, you could check chromedriver issues[^], to see whether it is a known problem.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Chromedriver is included in the project ( project\bin\debug). As I said 'driver_Navigated' firing only when pages are navigated using code. When I navigate manually in Chrome browser driver_Navigated is not firing.
|
|
|
|
|
srikrishnathanthri wrote: Chromedriver is included in the project ( project\bin\debug). The site states that it needs to be on the system path; having it in the project directory does not include it in that path.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I recently started using MS Excel 2016 (online). When I debug a macro, variable values no longer show when I put the mouse on them. Is this a "works as intended" or is there an option to turn on somewhere?
Thanks so much!
|
|
|
|
|
Hi,
I wrote 2 addins doing the same. one for word 2007 and one for 2013. all works fine in develepment but when I try to load it as a com addin I get the message that it's not a valid office addin. someone knows what I'm doing wrong?
Jan
|
|
|
|
|
Hi.
I have hit a snag. I need to send a continuous data stream to a Access Db using VB 2010. I can only send one instance of it at a time at the moment. Is it possible to send data continuously to a Access Db?
Regards.
|
|
|
|
|
AFAIK, MSAccess does not support streaming out of the box. SQL Server has some functions, but that would be assuming that you are streaming to a single field (most likely a varbinary(max)). If you keept streaming to that single record, you'd end up with a table containing one record and one very huge and hard to manage blob.
I'd recommend you write your stream in chuncks (like now) to some buffer (a queue, or a memory mapped file), and have some other application put those chunks in Access (a record for each chunk).
Is there any reason why you would need to save it as a "continious blob"? You might be receiving data as a very long array of bytes, but that does not mean that you're only allowed to save it in that format
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi.
It must be continuous as another app will get info from that field. The field will be cleared regularly per minute as to curb the size of the field.
I have got it to write to the field but... The loop keeps on freezing the app. What bugs me though is that I coded a MsgBox to confirm the connection; then the app works fine but as soon as I click 'OK' the app freezes.
Any suggestions?
|
|
|
|
|
Gus113 wrote: It must be continuous as another app will get info from that field. The field will be cleared regularly per minute as to curb the size of the field. Those two sentences contradict each other. It should not matter to the consuming process how it is stored, only needs to now whether there is data. A queue in any form would be the way to go. That way the consuming process is also not influenced by any hiccups in reading.
Gus113 wrote: What bugs me though is that I coded a MsgBox to confirm the connection; then the app works fine but as soon as I click 'OK' the app freezes. Sounds like you are doing your processing work in the UI-thread; if that is busy doing other things than it will stop painting. Move your work to a separate thread.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yeah, this doesn't sound like Access, or any database for that matter, is the proper solution for this problem.
This sounds like more of a thing handled by Message Queuing (MSMQ). But, even this is speculation because we have no idea what this data is, what it's used for, how fault tolerant it needs to be, ... can you go without data at all for a period of time, ...??
As for the app freezing, you're probably doing stuff on the UI thread that you should be doing in a separate thread.
|
|
|
|
|
Thanks Dave. I have got it to work.
|
|
|
|
|
Hi,
I have two sheets. One having warehouse(18 warehouse) and second having shop (50 Shops).
I need to map shops against warehouse within 200 KM.
I have written one code for the same but need to loop it. Code is mentioned below
Code will copy first warehouse from warehouse sheet and paste it against each all 50 shops in shop sheet.
Then one formula in the sheet (already updated in shop sheet) calculate the difference in KM between each shop and first warehouse. Then filtered out shops within 200 km, copy and paste (transpose) against first warehouse in warehouse sheet. Now I want to do same procedure for second warehouse then third till end. Please help
==================================
Sub RADIUS()
Worksheets("SHOP").Activate
AutoFilterMode = False
Range("f2:g4175").Clear
Worksheets("WAREHOUSE").Activate
Range("C2:d2").Select
Selection.Copy
Worksheets("SHOP").Activate
Range("f2:g4175").PasteSpecial _
Operation:=xlPasteSpecialOperationAdd
Application.Calculation = xlCalculationAutomatic
AutoFilterMode = True
Range("A1:h1").AutoFilter Field:=8, Criteria1:="<=200"
Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row).SpecialCells(xlCellTypeVisible).Copy _
Worksheets("WAREHOUSE").Activate
Range("e" & Rows.Count).End(xlUp).Offset(1).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
End Sub
|
|
|
|
|
|
Please help me in the same
|
|
|
|
|
|
Nobody knows what you exactly want to do, so it's always needed that you understand - at least to a certain extent - the code and methods someone gives you. It would make a lot of sense to read the hints Richard gave you, instead of trying to make him do your homework.
You can loop through your worksheets - assuming here that the shop worksheets are all named something with "Shop" - like this:
Sub LoopWorksheets()
Dim ws As worksheet
For Each ws In ActiveWorkbook.Worksheets
If UCase(ws.Name) Like UCase("Shop*") Then
RADIUS ws
End If
Next
Application.Calculation = xlCalculationAutomatic
End Sub
The UCASE is needed, because the function is case sensitive (looking for "Shop" would not match your sheet "SHOP")! I would also recommend you to rename your method, because "radius" is a math function and might lead to confusion.
Your function would then consume every worksheet that your loop passes:
Sub RADIUS(ByVal sheet As worksheet)
You can also streamline your function a lot. Instead of
Worksheets("WAREHOUSE").Activate
Range("C2:d2").Select
Selection.Copy
sheet.Activate
Range("f2:g4175").PasteSpecial Operation:=xlPasteSpecialOperationAdd
you could just use one line:
sheet.Range("f2:g4175").Value = Worksheets("WAREHOUSE").Range("C2:d2").Value There's no need to activate every worksheet before doing something on/with it. This is only needed in certain cases, e.g. if you explicitly want to "Select" an object (sheet, range, cell etc.). Usually you just reference the range like "sheet.range(...)". For example
ActiveWorkbook.Worksheets("WAREHOUSE").Range("A1:H1").Interior.ColorIndex = 3 will paint your WAREHOUSE sheet titles red.
Regards
Mick
modified 26-Apr-16 10:31am.
|
|
|
|
|
|
Most likely you need to fix your code.
|
|
|
|
|
Hello,
I have a funny question which arises from the effects I recognize in a sample app.
At a certain point the sample app reads the files of a directory into an array. Since the path to "System32" was anyway pre-set in the sample, I realized the array gets filled with 2560 strings in the array - despite of more than 5000 files in that directory. After changing the path to another Windows directory ("System"), the array again filled with 2560 files only... No error in both cases. Then I changed the path to a different directory (holding approx. 6000 files), and the "GetFiles" array got filled with exactly the number of files existing.
I tried this several times with other directories, and it seems that everything works (i.e. reads and counts) fine as long as the path isn't a system directory. Is this behaviour normal? Or what else might be going on?
Thank you for any insights
Mick
|
|
|
|
|
Sounds like you're running a 32-bit application on a 64-bit OS. The File System Redirector[^] intercepts your request to access C:\Windows\System32 , and redirects it to C:\Windows\SysWOW64 instead.
You can either compile your application as 64-bit; use the special SysNative alias for the System32 directory; or P/Invoke the Wow64DisableWow64FsRedirection[^] and Wow64RevertWow64FsRedirection[^] functions to disable the file system redirector for your application.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you, Richard, for sharing the knowledge as well as probable solutions. It's very likely that the 32/64bit thing is the reason for the effect.
As I wrote before, it's a sample app I examined, so right now I don't need the solutions. But now I'm more prepared for that kind of possible surprises There's still some queston marks, since SysWOW64 has only 2517 (not 2560) file entries on top-level, but it's good enough for having a first clue and some attention around that issue.
Regards
Mick
|
|
|
|
|
Be careful with the overloads:
string[] files = System.IO.Directory.GetFiles(@"C:\windows\system32", "*.*", SearchOption.AllDirectories); looks into sub-directories, while the simple form
string[] files = System.IO.Directory.GetFiles(@"C:\windows\system32"); does not.
I think that is the reason for the differences you experienced.
|
|
|
|