Find Jobs
Hire Freelancers

Fix C# Selenium Web Driver is grabbing the wrong element location

£10-20 GBP

Tamamlandı
İlan edilme: 5 yıldan fazla önce

£10-20 GBP

Teslimde ödenir
I am trying to take a screenshot of a webpage I have accessed using selenium web driver. I then want to crop the screenshot to only return a specific element. This happens to be an image. I cannot grab the image file by the location, since re-requesting the same src will generate a different file. I am unable to specify the image height and width as this will be dynamic. Using the following code, I am able to successfully return the image height and width, however the screenshot that is saved is not the image, but another part of the page with the same dimensions as the image, which leads me to believe the location must be wrong? Here's the code: IWebElement image = [login to view URL]([login to view URL]("//*[@id='hipTemplateContainer']/div[1]/img")); [login to view URL]("{0} {1} {2} {3}",image.Location.X, image.Location.Y, [login to view URL], [login to view URL]); TakeScreenshot(driver, image); private static void TakeScreenshot(IWebDriver driver, IWebElement element) { try { string fileName = [login to view URL]("yyyy-MM-dd HH-mm-ss") + ".jpg"; Byte[] byteArray = ((ITakesScreenshot)driver).GetScreenshot().AsByteArray; [login to view URL] screenshot = new [login to view URL](new [login to view URL](byteArray)); [login to view URL] croppedImage = new [login to view URL](element.Location.X, element.Location.Y, [login to view URL], [login to view URL]); screenshot = [login to view URL](croppedImage, [login to view URL]); [login to view URL]([login to view URL](@"C:\Users\Sam\Desktop\Images\" + fileName, [login to view URL])); } catch (Exception e) { [login to view URL]([login to view URL] + ' ' + [login to view URL]); } I have tried to wait for the page to finish loading, that made no difference. I have tried to get the parent element, but that also returned the wrong sizing.
Proje No: 17702921

Proje hakkında

4 teklif
Uzaktan proje
Son aktiviteden bu yana geçen zaman 6 yıl önce

Biraz para mı kazanmak istiyorsunuz?

Freelancer'da teklif vermenin faydaları

Bütçenizi ve zaman çerçevenizi belirleyin
Çalışmanız için ödeme alın
Teklifinizin ana hatlarını belirleyin
Kaydolmak ve işlere teklif vermek ücretsizdir
Seçilen:
Kullanıcı Avatarı
Hello, i can easly fix it for you, just tell me what element to grab and from where i have already a working selenium project ready for that if you have any questions don't hesitate to contact me.
£18 GBP 1 gün içinde
4,8 (17 değerlendirme)
3,5
3,5
4 freelancers are bidding on average £17 GBP for this job
Kullanıcı Avatarı
Hello, I am ready to discuss project with you. I have worked on selenium web driver scrapping using C# extensively and have worked on taking screenshot also, I would like to discuss in detail to see which website you referring to get screenshot and to understand other details. Looking forward to have further project discussion on chat. Thanks. Vimal Arora
£18 GBP 1 gün içinde
4,9 (56 değerlendirme)
5,4
5,4
Kullanıcı Avatarı
Hello my name is Fares, i can get it done perfectly as you want let's chat when you are online,. Thanks
£13 GBP 1 gün içinde
4,7 (20 değerlendirme)
4,4
4,4
Kullanıcı Avatarı
hello dear i need this work because i have good experience in these problems and i will make friend with you and You can contact me if you have other problems
£18 GBP 1 gün içinde
0,0 (0 değerlendirme)
0,0
0,0

Müşteri hakkında

   UNITED KINGDOM bayrağı
CAMBRIDGE, United Kingdom
5,0
31
Ödeme yöntemi onaylandı
Ağu 21, 2014 tarihinden bu yana üye

Müşteri Doğrulaması

Teşekkürler! Ücretsiz kredinizi talep etmeniz için size bir bağlantı gönderdik.
E-postanız gönderilirken bir şeyler yanlış gitti. Lütfen tekrar deneyin.
Kayıtlı Kullanıcı İlan Edlien Toplam İş
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Ön izleme yükleniyor
Coğrafik konum için izin verildi.
Giriş oturumunuzun süresi doldu ve çıkış yaptınız. Lütfen tekrar giriş yapın.