MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / ToDictionary

Method ToDictionary

dotnet/src/webdriver/PrintOptions.cs:183–231  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

181 }
182
183 internal Dictionary<string, object?> ToDictionary()
184 {
185 Dictionary<string, object?> toReturn = new Dictionary<string, object?>();
186
187 if (this.Orientation != PrintOrientation.Portrait)
188 {
189 toReturn["orientation"] = this.Orientation.ToString().ToLowerInvariant();
190 }
191
192 if (this.scale != 1.0)
193 {
194 toReturn["scale"] = this.scale;
195 }
196
197 if (this.OutputBackgroundImages)
198 {
199 toReturn["background"] = this.OutputBackgroundImages;
200 }
201
202 if (!this.ShrinkToFit)
203 {
204 toReturn["shrinkToFit"] = this.ShrinkToFit;
205 }
206
207 if (this.pageSize.Height != DefaultPageHeight || this.pageSize.Width != DefaultPageWidth)
208 {
209 Dictionary<string, object?> pageSizeDictionary = new Dictionary<string, object?>();
210 pageSizeDictionary["width"] = this.pageSize.Width;
211 pageSizeDictionary["height"] = this.pageSize.Height;
212 toReturn["page"] = pageSizeDictionary;
213 }
214
215 if (this.margins.Top != DefaultMarginSize || this.margins.Bottom != DefaultMarginSize || this.margins.Left != DefaultMarginSize || this.margins.Right != DefaultMarginSize)
216 {
217 Dictionary<string, object?> marginsDictionary = new Dictionary<string, object?>();
218 marginsDictionary["top"] = this.margins.Top;
219 marginsDictionary["bottom"] = this.margins.Bottom;
220 marginsDictionary["left"] = this.margins.Left;
221 marginsDictionary["right"] = this.margins.Right;
222 toReturn["margin"] = marginsDictionary;
223 }
224
225 if (this.pageRanges.Count > 0)
226 {
227 toReturn["pageRanges"] = new List<object?>(this.pageRanges);
228 }
229
230 return toReturn;
231 }
232
233 private static int ParsePageRangePart(string pageRangePart, int defaultValue)
234 {

Callers

nothing calls this directly

Calls 1

ToStringMethod · 0.45

Tested by

no test coverage detected